ALT Linux Sisyphus discussions
 help / color / mirror / Atom feed
From: Alexey Tourbin <at@altlinux.ru>
To: sisyphus@lists.altlinux.org
Subject: Re: [sisyphus] bash
Date: Tue, 28 Aug 2012 10:46:52 +0400
Message-ID: <20120828064652.GC18053@altlinux.org> (raw)
In-Reply-To: <503C5A46.4010209@kde.kiev.ua>

On Tue, Aug 28, 2012 at 08:42:30AM +0300, Denis Kuznetsov wrote:
> Таки интересная ситуация...
> Согласно:
>     http://www.gnu.org/software/bash/manual/bashref.html#Quote-Removal
>     http://www.gnu.org/software/bash/manual/bashref.html#Pattern-Matching
> А также:
>     $ shopt | grep extglob
>     extglob            on
> А еще:
>     $ ls +([0-9A-z])
>     $ rpm -qf $SHELL
>     bash-3.2.51-alt1
> Все укладывается в синтаксис bash-3.2.51 
> вошедшего в p6.
> 
> При проверке синтаксиса:
> $ echo 'ls +([0-9A-z])' | bash -n
> bash: line 1: syntax error near unexpected token `('
> bash: line 1: `ls +([0-9A-z])

Вы правы, это расширенный синтаксис:

$ echo 'ls +([0-9A-z])' |bash -n
bash: line 1: syntax error near unexpected token `('
bash: line 1: `ls +([0-9A-z])'
$ echo 'ls +([0-9A-z])' |bash -O extglob -n
$

Выходит что, к сожалению, выполнение текущей команды может влиять
на синтаксический разбор последующей команды - получается такой недо-перл
(в перле команды, модифицирующие синтаксис, выполняются безусловно, даже в
режиме syntax check).

Кстати, диапазон [A-z] является некорректным, но никто не жалуется.
То есть он к синтаксису не относится, а круглые скобки - относятся.
Интересно, как всё это вообще работает. :-)

> Возникает вопрос, как это обойти в Sisyphus и 
> p6?

Простого способа передать "-O extglob" в shell.req пока нету.
Можно избирательно отключить поиск зависимостей в проблемном скрипте:
%add_findreq_skiplist */usr/bin/zpool_layout
либо менее избирательно:
AutoReq: yes, noshell
Тогда часть зависимостей, если в скриптах есть самостоятельные
нетривиальные зависимости, нужно будет написать вручную.

> Эту же проблему наблюдаю на CentOS 6.1 и FreeBSD 
> (но они мне побоку).
> 
> 
> 28.08.2012 00:17, Dmitry V. Levin пишет:
> >On Mon, Aug 27, 2012 at 10:19:17PM +0300, Denis Kuznietsov wrote:
> >>27.08.2012 18:56, Alexey Tourbin пишет:
> >>>Копать туда, что shell syntax check у этого
> >>>скрипта не проходит:
> >>>
> >>>$ sh -n test.sh
> >>>test.sh: line 9: syntax error near unexpected token `('
> >>>test.sh: line 9: `            ls
> >>>${LABEL}-+([0-9a-f])-switch-port:${p}-slot:+([0-9]) \'
> >>>
> >>>Соответственно, rpm не дает запаковать
> >>>этот скрипт в абсолютно
> >>>неработающем виде, есть считается, что
> >>>это /bin/sh или /bin/bash скрипт.
> >>Да это баш. подозреваю что может даже 4-ка
> >Нет, вышепроцитированное не 
> >укладывается в синтаксис bash 4-й версии.


  parent reply	other threads:[~2012-08-28  6:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-27 13:39 [sisyphus] shell.req Denis Kuznetsov
2012-08-27 15:56 ` Alexey Tourbin
2012-08-27 19:19   ` Denis Kuznietsov
2012-08-27 21:17     ` Dmitry V. Levin
2012-08-28  6:46         ` Alexey Tourbin [this message]
2012-08-28  7:14           ` [sisyphus] bash Denis Kuznetsov

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=20120828064652.GC18053@altlinux.org \
    --to=at@altlinux.ru \
    --cc=sisyphus@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 Sisyphus discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/sisyphus/0 sisyphus/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 sisyphus sisyphus/ http://lore.altlinux.org/sisyphus \
		sisyphus@altlinux.ru sisyphus@altlinux.org sisyphus@lists.altlinux.org sisyphus@lists.altlinux.ru sisyphus@lists.altlinux.com sisyphus@linuxteam.iplabs.ru sisyphus@list.linux-os.ru
	public-inbox-index sisyphus

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


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