SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hello Maintainers, Since pkgtools uses dd output, and the output text is not what pkgtools expected in some cases, it would be better to add "LC_ALL=C" to the beginning of the script.
Isn't C already set as LC_MESSAGES by default to all shells?
Yes. But nearly nobody runs a system with all defaults. It'll be better to explicitly set locale to C, POSIX, or en_US.UTF-8 if UTF is necessary.
BTW, the LANGUAGE environment variable also affects message locale.
All script writers are going to have to do settings like this for just about any program they capture output from. The complication will be the cases where they need to either have some programs just output to the user, or need to echo the captured output to the user.
Capturing output in a script has always been risky because some output formats change for other reasons, too, or portable scripts end up with different outputs on different systems. For decades, I've said we need programs specific for scripts, or at least special options to get script output somewhere. But even that doesn't handle the cases of output to be interpreted and shown to the user. The output probably needs a markup, isolating the informational parts from the display parts, along with the appropriate script tool to isolate them.
That, or switch to another scripting language that has built in methods to access data and perform functions otherwise giving to programs like dd. I'll suggest Python.
I set LANG=C on all my slackbuild scripts for this reason. I've encountered a few cases where the "configure" script expects a given program output in this locale and wouldn't work or properly detect something in that case. I also change the locale in slackroll, which in turn calls installpkg, upgradepkg, etc. As mentioned above, this is a risk you have with every program that needs to parse the output of some other, and the program user may have changed the locale to their needs. The exact locale change I use in slackroll is pretty paranoid and conservative:
* Remove LC_COLLATE, LC_CTYPE, LC_MONETARY, LC_MESSAGES, LC_NUMERIC, LC_TIME, LC_ALL, LANGUAGE, LANG from the environment.
* Set LANG to "C".
Nothing is better (and faster) for package management than some programs written in C/C++ and linked full-static. They depend only on the Kernel and maybe Shell.
Slackware specifications for package management are very simple. If Slackware team is interested, I can write an equivalent installpkg / upgradepkg / removekg in a few weeks, using libarchive.
And the changes were minor in Slackware. For a full-static build, the static libraries would be needed since libarchive. So most likely, libarchive, XZ and libxml should be rebuilded with '--enable-static'.
Last edited by Darth Vader; 04-21-2011 at 12:05 PM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.