ALT Linux Team development discussions
 help / color / mirror / Atom feed
From: Alexey Tourbin <at@altlinux.ru>
To: ALT Devel discussion list <devel@lists.altlinux.org>
Subject: Re: [devel] 0ldconfig.filetrigger (packages/rpm: heads/altlinux-4.1)
Date: Sat, 8 Nov 2008 17:52:20 +0300
Message-ID: <20081108145220.GA8826@altlinux.org> (raw)
In-Reply-To: <20081108142947.GA30698@wo.int.altlinux.org>

[-- Attachment #1: Type: text/plain, Size: 1779 bytes --]

On Sat, Nov 08, 2008 at 05:29:47PM +0300, Dmitry V. Levin wrote:
> On Thu, Nov 06, 2008 at 07:13:31PM +0300, Alexey M. Tourbin wrote:
> > --- a/scripts/0ldconfig.filetrigger
> > +++ b/scripts/0ldconfig.filetrigger
> [...]
> > +	# 0) Short circuit condition: if a library is already found,
> > +	# skip the remaining list of non-system libraries.  Note that
> > +	# the input file list is sorted, and "/lic" collates after
> > +	# "/lib" and "/lib64".
> > +	if [ -n "$lib" ] && LC_ALL=C [ "$f" '>' "/lic" ]; then
> 
> Тогда лучше написать без обиняков: [ "$f" '>' "/lib64" ]

Не совсем.  Нужно обрубать цикл только тогда, когда все файлы
"/lib64/*" уже пройдены.  А так любой файл "/lib64/*" будет больше
"/lib64", а ведь флаг sys=1 ещё не выставлен.  То есть то, что ты
предлагаешь, -- неверно.  Но идея понятна: условие окончание цикла
можно выразить ещё немного более точно.  Если во всех локалях
"/lib64" > "/lib/" (цифра больше слеша), то в принципе можно сравнивать
с "/lib7".

Тут есть ещё одна тонкость, на которую я обратл внимание: в bash(1)
сказано
       string1 > string2
              True if string1 sorts after string2 lexicographically in the current locale.

Но на самом деле в bash/test.c:binary_test() используется strcmp:
   379    else if ((op[0] == '>' || op[0] == '<') && op[1] == '\0')
   380      return ((op[0] == '>') ? (strcmp (arg1, arg2) > 0) : (strcmp (arg1, arg2) < 0));
то есть, вопреки документации, локаль не используется.

А в ash(1) другая формулировка, которая вроде бы подразумевает strcmp:
            s1 > s2       True if string s1 comes after s2 based on the ASCII value of their characters.

В общем, всё это заставило меня придумать вот такую странную,
но вроде бы наиболее безопасную конструкцию.

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

  reply	other threads:[~2008-11-08 14:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-06 16:13 Alexey M. Tourbin
2008-11-08 14:29 ` Dmitry V. Levin
2008-11-08 14:52   ` Alexey Tourbin [this message]
2008-11-08 15:28     ` Dmitry V. Levin
2008-11-08 14:32 ` Dmitry V. Levin
2008-11-08 15:10   ` Alexey Tourbin
2008-11-08 15:26     ` Alexey Tourbin
2008-11-08 15:30       ` Dmitry V. Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081108145220.GA8826@altlinux.org \
    --to=at@altlinux.ru \
    --cc=devel@lists.altlinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux Team development discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
		devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
	public-inbox-index devel

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git