Managing packages like a boss
-
There are quite a few interesting things living inside Tizen. One of them is the central manager for all installed apps - Package Manager. This little fellow was written with all the glory of Korean C programming. Its job is simple - manage installed stuff. When something is installed it puts all the app metadata inside its database. Simple stuff; you would imagine in 2016 people know how to do it properly. Or not:
snprintf(query, MAX_QUERY_LEN, "insert into package_info(" \ "package, package_type, package_version, package_api_version, package_tep_name, " \ "install_location, package_size, package_removable, package_preload, package_readonly, " \ "package_update, package_appsetting, package_nodisplay, package_system, author_name, " \ "author_email, author_href, installed_time, installed_storage, storeclient_id, " \ "mainapp_id, package_url, root_path, csc_path, package_support_disable) " \ "values(" \ "'%s', '%s', '%s', '%s', '%s', " \ "'%s', '%s', '%s', '%s', '%s', " \ "'%s', '%s', '%s', '%s', '%s', " \ "'%s', '%s', '%s', '%s', '%s', " \ "'%s', '%s', '%s', '%s', '%s')", \ mfx->package, mfx->type, mfx->version, __get_str(mfx->api_version), __get_str(mfx->tep_name), __get_str(mfx->installlocation), __get_str(mfx->package_size), mfx->removable, mfx->preload, mfx->readonly, mfx->update, mfx->appsetting, mfx->nodisplay_setting, mfx->system, __get_str(auth_name), __get_str(auth_email), __get_str(auth_href), mfx->installed_time, mfx->installed_storage, __get_str(mfx->storeclient_id), mfx->mainapp_id, __get_str(mfx->package_url), mfx->root_path, __get_str(mfx->csc_path), mfx->support_disable);
For the record, if someone is masochistic enough to wonder:
static const char *__get_str(const char *str) { if (str == NULL) { return PKGMGR_PARSER_EMPTY_STR; } return str; }
Let's inject all the things! And guess what - nobody gives a shit at this certain Korean corporation. I wonder when the first DROP TABLE package_info app pops up.
-
@NeighborhoodButcher said in Managing packages like a boss:
I wonder when the first DROP TABLE package_info app pops up.
Bobby Tables 2.0
-
@NeighborhoodButcher And it will be interesting when one fine day the compiler or the run-time library exerts its right to use whatever identifier it wants that contains a double underscore, and starts using
__get_str
for some internal purpose...("Get Single-Threaded Runtime" anyone?)
-
@Steve_The_Cynic said in Managing packages like a boss:
@NeighborhoodButcher And it will be interesting when one fine day the compiler or the run-time library exerts its right to use whatever identifier it wants that contains a double underscore, and starts using
__get_str
for some internal purpose...("Get Single-Threaded Runtime" anyone?)
Hey Steve, you are the cynic! :)
-
Someone explain to me the blue.
Is there a computer language that has a keyword named
MPTY_STR
?
-
@blakeyrat said in Managing packages like a boss:
Is there a computer language that has a keyword named MPTY_STR?
HLJS seems to think that objectiveC does....
is it right? dunno. but it clearly thinks that.
-
@accalia Google is inconclusive
-
@accalia no, based on the styles, everything in that burnt orange color is a keyword.
MPTY_STR
ishljs-built_in
, whatever that means.
-
@anotherusername said in Managing packages like a boss:
MPTY_STR is hljs-built_in
that just raises EVEN MORE QUESTIONS!
-
@blakeyrat said in Managing packages like a boss:
Is there a computer language that has a keyword named MPTY_STR?
Apparently the highlighter is highlighting anything that starts with
MP
(case sensitive). No clue why.edit: well, it's ignoring it if it's inside a comment, at least.
-
@anotherusername said in Managing packages like a boss:
highlighting anything that starts with MP
But
PKGMGR_PARSER_EMPTY_STR
doesn't start withMP
.
-
@NeighborhoodButcher Where did you get this code? Is it really in the Tizen repo? What is Tizen anyway?
-
@NedFodder no, but it contains a substring that does, and based on the quick experimentation that I did, apparently that's all the highlighter is looking for.
-
@blakeyrat said in Managing packages like a boss:
Someone explain to me the blue.
Is there a computer language that has a keyword named
MPTY_STR
?I actually wonder myself what's going on here. I think NodeBB barfed when it recognized C.
@Captain said in Managing packages like a boss:
@NeighborhoodButcher Where did you get this code? Is it really in the Tizen repo? What is Tizen anyway?
Funny, it's open source, but I can't find it in Google. Here's some arcane version: https://searchcode.com/codesearch/view/27545466/Scratch that - it's in the official repo, silly me: https://review.tizen.org/git/
And Tizen is shit - don't let anyone tell you different.
-
official repo,
Incidentally, would that be a good place to make feature requests for Tizen-based TV's, or should I learn Korean first?
-
@Mikael_Svahnberg said in Managing packages like a boss:
official repo,
Incidentally, would that be a good place to make feature requests for Tizen-based TV's, or should I learn Korean first?
Depends if you want to be ignored in Korean.
-
@NeighborhoodButcher said in Managing packages like a boss:
@Mikael_Svahnberg said in Managing packages like a boss:
official repo,
Incidentally, would that be a good place to make feature requests for Tizen-based TV's, or should I learn Korean first?
Depends if you want to be ignored in Korean.
Got it. I'll just file the feature request by saying it out loud in Swedish to my TV then. It is my understanding that there is at least someone listening then.
-
@Mikael_Svahnberg Your SO?
-
@NeighborhoodButcher said in Managing packages like a boss:
I actually wonder myself what's going on here. I think NodeBB barfed when it recognized C.
You can specify a language name directly after the opening triple-backtick (```) of a code block if you don't want to rely on auto-detection (which isn't all that reliable).
Like this:
`​``c Your code here `​``
-
@PleegWat said in Managing packages like a boss:
@Mikael_Svahnberg Your SO?
Not when I'm speaking computerish.
-
@accalia is this a good answer?
-
@anotherusername said in Managing packages like a boss:
No clue why.
Because someone doesn't know how to anchor their regular expressions to the start of a word.
-
@NeighborhoodButcher said in Managing packages like a boss:
I think NodeBB barfed when it recognized C.
"Great-grandpa?!' What are you doing with that variable???!!! Oh my god!!!!"
-
@Captain said in Managing packages like a boss:
What is Tizen anyway?
You got to be kidding me! Have you forgotten about the most interesting article in wtd? You should re-enlighten yourself again, or else spank spank!
-
@dse COMPLAIN
-
@ben_lubar Quit-yer-BITCH-in. You know you like the occasional SPANK SPANK.
-
@MathNerdCNU You know that you done goofed when your error messages evoke images like this in one's imagination:
-
@NeighborhoodButcher what are you talking about? That looks like a perfectly fine parametrized query. Though the syntax highlighter seems broken. And I wonder what DB interface uses
%s
because it's...snprintf
they... that... no.