[aur-general] Why /etc/issue starts with invisible chars?
Lyman
lymanrb at gmail.com
Fri Mar 21 08:24:01 EDT 2008
Roman Kyrylych 写道:
> 2008/3/21, Lyman <lymanrb at gmail.com>:
>> Roman Kyrylych 写道:
>>
>>> 2008/3/21, Lyman <lymanrb at gmail.com>:
>> >> Hi, all
>> >>
>> >> I found this issue when I was trying Sysmonitor in the package
>> >> screenlets because Sysmonitor can not show my distribution name correctly.
>> >>
>> >> At the beginning I thought that it was a bug of screenlets, however,
>> >> when I dug into its source code, I realized that it could be a "bug"
>> >> introduced by Archlinux because the /etc/issue starts with some
>> >> invisible chars.
>> >>
>> >> Here's the hexdump of /etc/issue in Archlinux. It is obviously that the
>> >> first line in this file is not the distribution name.
>> >>
>> >> 00000000 1b 5b 48 1b 5b 32 4a 0a 41 72 63 68 20 4c 69 6e
>> >> |.[H.[2J.Arch Lin|
>> >> 00000010 75 78 20 28 43 6f 72 65 20 44 75 6d 70 29 20 20 |ux (Core
>> >> Dump) |
>> >> 00000020 5c 72 20 20 28 5c 6e 29 20 28 5c 6c 29 0a 0a |\r (\n)
>> >> (\l)..|
>> >>
>> >> I've checked other two distribution, CentOS and Ubuntu (that's all I
>> >> have at the moment), both of them presents the their name in the first line.
>> >>
>> >> I guess most of the applications just use the first line in /etc/issue
>> >> as distribution name (so do screenlets). I think Archlinux should comply
>> >> with "Rule of Least Surprise" on this issue. If the invisible chars are
>> >> just for clearing screen, we can do that from the second line.
>> >
>> > We already do. :-)
>> > /etc/issue is *not* a way to check for distribution name. Apps that do
>> > this are wrong.
>> > Most distros have /etc/distroname-release files as well (that contain
>> > the version, that's why it's empty in Arch).
>>
>> Things seem not that simple, though. On CentOS, I found
>> /etc/redhat-release. On Ubuntu, there's no /etc/ubuntu-release but only
>> /etc/lsb-release. Unfortunately, the latter one is a formatted text file
>> and applications can not depend on it by a rule as simple as "the first
>> line".
>
> /etc/lsb-release is defined in LSB, maybe there are simpler ways to
> get distro name on LSB compliant system, I don't know.
>
>> Considering there's so many distributions in Linux world, it seems quite
>> confusing for developers to do something absolutely "correct", right?
>>
>> I will forward these information to the developers of screenlets.
>> However, I still insisted on suggesting changing /etc/issue to a
>> "normal" one because I didn't see any advantages of inserting invisible
>> chars in the first line. By doing just a little "favor", it will makes
>> Archlinux more "compatible" && friendly to both developers and end
>> users, I think.
>
> Ok, I'll explain it in another way: /etc/issue is intended to be
> customized by user,
> thus software should *not* rely on it to get a distro name.
You are right. I feel so sorry for replying last mail without taking a
look at manpage of /etc/issue first.
> /etc/distroname-release was invented exactly to solve this issue.
>
> If developers of screenlets wanted to make their life easier by
> writing less lines of code and relying on /etc/issue to have a
> distroname as first word/line - that's clearly a bug (or let's say
> "wrong solution") in their code.
Though I don't think the invention is simple enough, this is the
reality. Thank you very much for your patience :)
>
> We will not "fix" it by changing our /etc/issue.
> BTW, removing those "invisible" chars at the beginning makes the text
> appear on screen without cleaning it first, so you'll see the rest of
> daemons loading output.
>
>> > Good written apps check for *existence* of /etc/arch-release file to
>> > know whether they are on Arch Linux.
>> > See virtualbox's installer for example how a check for distribution
>> > should be made.
>> >
>>
>> Can you please point out which file is the installer? There's so many
>> files in the package virtualbox-ose and I failed to find an "obvious"
>> installer. Thanks.
>
> See http://virtualbox.org/browser/trunk/src/VBox/Installer/linux/VBoxSysInfo.sh
> Notice that all distros except Ubuntu use /etc/distroname-release even
> those that are LSB-compliant (I believe at least Fedora is).
>
More information about the aur-general
mailing list