[aur-general] Why /etc/issue starts with invisible chars?
Lyman
lymanrb at gmail.com
Fri Mar 21 05:21:08 EDT 2008
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".
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.
> 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.
lyman
More information about the aur-general
mailing list