From: Alexey Tourbin <at@altlinux.ru>
To: ALT Devel discussion list <devel@lists.altlinux.org>
Subject: Re: [devel] [git update] packages/hasher: heads/master
Date: Sat, 11 Aug 2007 02:35:14 +0400
Message-ID: <20070810223514.GA7530@solemn.turbinal> (raw)
In-Reply-To: <20070810221738.GA9864@nomad.office.altlinux.org>
[-- Attachment #1: Type: text/plain, Size: 2575 bytes --]
On Sat, Aug 11, 2007 at 02:17:38AM +0400, Dmitry V. Levin wrote:
> On Fri, Aug 10, 2007 at 08:29:33PM +0400, Alexey M. Tourbin wrote:
> > Update of /people/at/packages/hasher.git
> [...]
> > On the "install ... && Verbose ... || Fatal ..." clauses. I think this
> > is overkill.
>
> Мне важно не только видеть причину сбоя, но и реакцию программы на сбой.
> Возможно, диагностика от install и достаточна. Решение принимается
> субъективно в каждом конкретном случае.
Я там дальше написал, что нельзя вообще всё проверить, и приходится
полагаться на некоторые вещи. Например, когда ты пишешь
if grep ^... file; then ...
ты не ожидаешь, что grep упадёт в SEGV, однако же #9941 (fixed).
Более строго, наверное, надо писать
if grep ^... file; rc=$?; [ $rc -eq 0 ]; then
match
elif [ $rc -eq 1 ]; then
no match
else
internal error
fi
А также если строго проверять статус, то нельзя пользоваться пайпами.
В общем, нужно каким-то образом предвидеть причину сбоя, тогда стоит
проверять и писать более человеческую диагностику. Иначе режим "sh -e"
даёт как бы оптимальный вариант -- не надо дописывать к каждой команде
"|| Fatal ...".
> > On the "if shell_function ...; then ...' clauses. This is evil. Don't use
> > shell function in the "if" conditions, because "sh -e" mode is disabled for
> > such calls. You can no longer expect that something "just fails".
>
> То же самое касается и shell_function && on_success || on_failure.
Это очень неприятно. :(
> > + rm -rf cache/contents/list.new
> > + mkdir -p $verbose cache/contents/list.new
>
> Здесь и далее, "rm -rf" с последующим "mkdir -p" на один и тот же каталог --
> это неконсистентно; "-p" сбивает с толку читающего код.
Да, надо было без -p делать.
> > + rm -rf cache/contents/tmp
> > + mkdir -p cache/contents/tmp
> > + local contents=cache/contents/tmp/contents
> [...]
> > + contents_index_bin=chroot/.host/contents_index_bin
> [...]
> > + cat <"$contents.bin" >"$contents_index_bin"
> > + rm -rf cache/contents/tmp
>
> Здесь можно заменить cat на mv.
Да.
> [...]
> > + rm -rf cache/contents/{index,list}
> > + install -p -m644 $verbose chroot/.host/contents_index_bin cache/contents/contents_index_bin
> > + install -p -m644 $verbose chroot/.host/contents_index_all.gz cache/contents/contents_index_all.gz
>
> Тогда уж ln.
Я сходу не сообразил, какие там права получаются. Как я понимаю,
изнутри чрута файл модифицировать нельзя, а вот снаружи чрута
модифицировать можно, и он изменится в чруте.
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
prev parent reply other threads:[~2007-08-10 22:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-10 22:17 ` Dmitry V. Levin
2007-08-10 22:35 ` Alexey Tourbin [this message]
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=20070810223514.GA7530@solemn.turbinal \
--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