ALT Linux Team development discussions
 help / color / mirror / Atom feed
* [devel] bash vs sh policy
@ 2003-10-08 14:39 Alexey Tourbin
  2003-10-08 14:41 ` [devel] " Michael Shigorin
  2003-10-08 15:24 ` [devel] " Denis Ovsienko
  0 siblings, 2 replies; 12+ messages in thread
From: Alexey Tourbin @ 2003-10-08 14:39 UTC (permalink / raw)
  To: devel

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

Господа,

Есть мнение, что /bin/bash иногда несправедливо используется вместо
/bin/sh, который был специально сделан для использования скриптами.
Сейчас /bin/sh -- это bash, собранный без libreadline и других
интерактивных расширений.  Тем не менее, #!/bin/sh скрипты не должны
использовать расширений bash, т.к. /bin/sh по определению является
"стандартным шеллом".

$ fgrep '#!/bin/bash' /etc/init.d/*
/etc/init.d/cbq:#!/bin/bash
/etc/init.d/kudzu:#!/bin/bash
/etc/init.d/squid:#!/bin/bash
$

Сейчас это не считается ошибкой, но со временем хочется избавиться от
таких вещей.  Тогда удастся заменить /bin/sh на что-нибудь более легкое,
например, ash.

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [devel] Re: bash vs sh policy
  2003-10-08 14:39 [devel] bash vs sh policy Alexey Tourbin
@ 2003-10-08 14:41 ` Michael Shigorin
  2003-10-08 15:24 ` [devel] " Denis Ovsienko
  1 sibling, 0 replies; 12+ messages in thread
From: Michael Shigorin @ 2003-10-08 14:41 UTC (permalink / raw)
  To: devel

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

On Wed, Oct 08, 2003 at 06:39:09PM +0400, Alexey Tourbin wrote:
> Сейчас это не считается ошибкой, но со временем хочется
> избавиться от таких вещей.  Тогда удастся заменить /bin/sh на
> что-нибудь более легкое, например, ash.

Только без революций. (вспоминая соответствующую дискуссию в
debian-russian не то что бы очень давно)

-- 
 ---- WBR, Michael Shigorin <mike@altlinux.ru>
  ------ Linux.Kiev http://www.linux.kiev.ua/

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [devel] Re: bash vs sh policy
  2003-10-08 15:24 ` [devel] " Denis Ovsienko
@ 2003-10-08 15:23   ` Alexey Tourbin
  2003-10-08 18:34     ` Dmitry Vukolov
  2003-10-09 20:34     ` [devel] Re: bash vs sh policy Mikhail Zabaluev
  0 siblings, 2 replies; 12+ messages in thread
From: Alexey Tourbin @ 2003-10-08 15:23 UTC (permalink / raw)
  To: ALT Devel discussion list

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

On Wed, Oct 08, 2003 at 06:24:06PM +0300, Denis Ovsienko wrote:
> > Сейчас это не считается ошибкой, но со временем хочется избавиться от
> > таких вещей.  Тогда удастся заменить /bin/sh на что-нибудь более легкое,
> > например, ash.
> ...перед этим исправив http://bugzilla.altlinux.ru/show_bug.cgi?id=2777

Хорошо!  Вот полный список пакетов, которые просят bash.  Думаю, что
большая часть несправедливо.  Но есть и справдливые.  Например,
distribute и url_handler явно просят в скриптах #!/bin/bash, т.к.
используют bash arrays.  И это правильно.

basesystem имеет явную зависимость на bash, потому что когда её оттуда
убрали, возникло много проблем с пересборкой пакетов в hasher'е,
к которым на данном этапе мы оказались не готовы.

alsa22-source-2.2.25_0.5.12a-alt1
ananas-0.3.4-alt0.1.pre5
anjuta-1.0.2-alt2
apmd-1:3.0.2-alt5
basesystem-1:sisyphus-alt9
bash-2.05b-alt5
bash-doc-2.05b-alt5
bash-examples-2.05b-alt5
bogofilter-contrib-0.14.5.4-alt1
bootsplash-1.2.1-alt1
console-tools-0.2.3-ipl19mdk
cups-1.1.18-alt8.1
cups-backend-ncp-1.1.18-alt8.1
dhcp-client-1:3.0.1-alt5
distribute-0.4.1-alt1
emacspeak-18.0-alt3
emacs-prog-modes-0.1-alt4
emu10k1-tools-20021121-alt2
ethemes-1.1-alt1
evms-2.1.1-alt11
FlightGear-data-0.9.2-alt1
foomatic-db-engine-3.0-alt6.20030310
gnu-ghostscript-drivers-7.07-alt0.1
gnu-ghostscript-utils-7.07-alt0.1
hotplug-2002_08_26-alt4
howto-utils-0.2.3-alt4
hpoj-0.90-alt6
hylafax-4.1.5-alt1
hylafax-server-4.1.5-alt1
iproute2-2.4.7-alt5.ss010824
j2se1.4-sun-javaws-1.4.2_01-alt1
kdevelop-2:2.1.2-alt3
krb5-server-1.3.1-alt2
kudzu-1.1.13-alt2
lbdb-0.27-alt4
libcomedi-devel-0.7.19-alt0.3
libgphoto2-2.1.2-alt1
lilo-22.4.1-alt4
lm_sensors-2.8.0-alt6
lm_sensors-graph-2.8.0-alt6
loganalyzer-0.20-alt4
midgard-data-1.5.1-alt0.3cvs20030916
minicom-2.1-alt1
mova-4.0-ipl7.1
packhouse-1.1.0-alt0.1.pre1
paralogger-1.0.3-alt1
patchutils-0.2.24-alt1
pcsc-lite-1.1.1-alt3
phpMyAdmin-2.5.3-alt3
pine-addrbk-tools-1.0-ipl9
postgresql-contrib-7.3.4-alt3
pptp-adsl-1.0.2-ipl9mdk
pptpd-1.1.3_20030409-alt1
quark-3.11-alt0.5
RealPlayer-8.0-alt2
sharutils-4.2.1-ipl11mdk
squid-2.5.STABLE4-alt1
swi-prolog-5.0.10-alt1
tetex-core-2.0-alt1
TORCS-1.2.1-alt1
url_handler-0.2.1-alt1
vaio-tools-0.0.1-alt5
vips-7.8.11-alt1
vnc-server-3.3.3r2-alt5
wdm-1.26-alt1
webmin-1.100-alt1
WindowMaker-0.80.2-alt18
xawtv-common-3.80-alt4
xmlto-0.0.12-alt1
ypbind-1:1.11-alt1
ypserv-2.6-alt1

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [devel] bash vs sh policy
  2003-10-08 14:39 [devel] bash vs sh policy Alexey Tourbin
  2003-10-08 14:41 ` [devel] " Michael Shigorin
@ 2003-10-08 15:24 ` Denis Ovsienko
  2003-10-08 15:23   ` [devel] " Alexey Tourbin
  1 sibling, 1 reply; 12+ messages in thread
From: Denis Ovsienko @ 2003-10-08 15:24 UTC (permalink / raw)
  To: ALT Devel discussion list


[...]
> Сейчас это не считается ошибкой, но со временем хочется избавиться от
> таких вещей.  Тогда удастся заменить /bin/sh на что-нибудь более легкое,
> например, ash.
...перед этим исправив http://bugzilla.altlinux.ru/show_bug.cgi?id=2777

--
    DO4-UANIC


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [devel] Re: bash vs sh policy
  2003-10-08 15:23   ` [devel] " Alexey Tourbin
@ 2003-10-08 18:34     ` Dmitry Vukolov
  2003-10-09  8:43       ` Dmitry V. Levin
  2003-10-09 10:02       ` Alexey Tourbin
  2003-10-09 20:34     ` [devel] Re: bash vs sh policy Mikhail Zabaluev
  1 sibling, 2 replies; 12+ messages in thread
From: Dmitry Vukolov @ 2003-10-08 18:34 UTC (permalink / raw)
  To: devel

On Wed, 8 Oct 2003 19:23:57 +0400
Alexey Tourbin <at@altlinux.ru> wrote:

> On Wed, Oct 08, 2003 at 06:24:06PM +0300, Denis Ovsienko wrote:
> > > Сейчас это не считается ошибкой, но со временем хочется избавиться
> > > от таких вещей.  Тогда удастся заменить /bin/sh на что-нибудь
> > > более легкое, например, ash.
> > ...перед этим исправив
> > http://bugzilla.altlinux.ru/show_bug.cgi?id=2> 
> Хорошо!  Вот полный список пакетов, которые просят bash.  Думаю, что
> большая часть несправедливо.  Но есть и справдливые.  Например,
> distribute и url_handler явно просят в скриптах #!/bin/bash, т.к.
> используют bash arrays.  И это правильно.

Где можно почитать про стандартный shell и понимаемые им конструкции?
Достаточно ли тестирования на работоспособность с ash для определения,
что скрипт использует только стандартные возможности?

-- 
Dmitry Vukolov


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [devel] Re: bash vs sh policy
  2003-10-08 18:34     ` Dmitry Vukolov
@ 2003-10-09  8:43       ` Dmitry V. Levin
  2003-10-09 10:20         ` Alexey Tourbin
  2003-10-09 10:02       ` Alexey Tourbin
  1 sibling, 1 reply; 12+ messages in thread
From: Dmitry V. Levin @ 2003-10-09  8:43 UTC (permalink / raw)
  To: ALT Devel discussion list

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

On Wed, Oct 08, 2003 at 10:34:40PM +0400, Dmitry Vukolov wrote:
> On Wed, 8 Oct 2003 19:23:57 +0400 Alexey Tourbin wrote:
> > On Wed, Oct 08, 2003 at 06:24:06PM +0300, Denis Ovsienko wrote:
> > > > Сейчас это не считается ошибкой, но со временем хочется избавиться
> > > > от таких вещей.  Тогда удастся заменить /bin/sh на что-нибудь
> > > > более легкое, например, ash.
> > > ...перед этим исправив
> > > http://bugzilla.altlinux.ru/show_bug.cgi?id=2> 
> > Хорошо!  Вот полный список пакетов, которые просят bash.  Думаю, что
> > большая часть несправедливо.  Но есть и справдливые.  Например,
> > distribute и url_handler явно просят в скриптах #!/bin/bash, т.к.
> > используют bash arrays.  И это правильно.
> 
> Где можно почитать про стандартный shell и понимаемые им конструкции?

Попробуйте посмотреть utilities/sh.html на
http://www.UNIX-systems.org/version3/online.html

> Достаточно ли тестирования на работоспособность с ash для определения,
> что скрипт использует только стандартные возможности?

Почти всегда.


-- 
ldv

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [devel] Re: bash vs sh policy
  2003-10-08 18:34     ` Dmitry Vukolov
  2003-10-09  8:43       ` Dmitry V. Levin
@ 2003-10-09 10:02       ` Alexey Tourbin
  2003-10-09 15:36         ` Alexey Tourbin
  2003-10-14 13:18         ` [devel] Re: shell peculiarity Alexey Tourbin
  1 sibling, 2 replies; 12+ messages in thread
From: Alexey Tourbin @ 2003-10-09 10:02 UTC (permalink / raw)
  To: devel

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

On Wed, Oct 08, 2003 at 10:34:40PM +0400, Dmitry Vukolov wrote:
> Где можно почитать про стандартный shell и понимаемые им конструкции?
> Достаточно ли тестирования на работоспособность с ash для определения,
> что скрипт использует только стандартные возможности?

Вообще, со "стандартным шеллом" есть некоторый конфуз.  De facto
стандартным шеллом считается чистый Bourne Shell, вещь вполоне себе
хорошо определенная.  Но стандарт POSIX определяет другой shell.  Вот
что об этом написано в /usr/share/doc/zsh-*/Zsh_Guide/zshguide01.html:

	...
	Some Linux systems also have another simpler Bourne shell clone,
	ash; as it's simpler, it's more like the original Bourne shell.

	Some more modern operating systems talk about `the POSIX shell'.
	This is an attempt to standardize UNIX shells; it's most like
	the Korn shell, although, a bit confusingly, it's often just
	called sh, because the standard says that it should be.
	Usually, this just means you get a bit extra free with your sh
	and it still does what you expect.

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [devel] Re: bash vs sh policy
  2003-10-09  8:43       ` Dmitry V. Levin
@ 2003-10-09 10:20         ` Alexey Tourbin
  0 siblings, 0 replies; 12+ messages in thread
From: Alexey Tourbin @ 2003-10-09 10:20 UTC (permalink / raw)
  To: ALT Devel discussion list

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

On Thu, Oct 09, 2003 at 12:43:02PM +0400, Dmitry V. Levin wrote:
> > Где можно почитать про стандартный shell и понимаемые им конструкции?
> 
> Попробуйте посмотреть utilities/sh.html на
> http://www.UNIX-systems.org/version3/online.html

О. :)  Спасибо.
На самом деле там есть ссылка utilities/xcu_chap02.html.

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [devel] Re: bash vs sh policy
  2003-10-09 10:02       ` Alexey Tourbin
@ 2003-10-09 15:36         ` Alexey Tourbin
  2003-10-14 13:18         ` [devel] Re: shell peculiarity Alexey Tourbin
  1 sibling, 0 replies; 12+ messages in thread
From: Alexey Tourbin @ 2003-10-09 15:36 UTC (permalink / raw)
  To: devel

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

On Thu, Oct 09, 2003 at 02:02:04PM +0400, Alexey Tourbin wrote:
> 	Some more modern operating systems talk about `the POSIX shell'.
> 	This is an attempt to standardize UNIX shells; it's most like
> 	the Korn shell, although, a bit confusingly, it's often just
> 	called sh, because the standard says that it should be.
> 	Usually, this just means you get a bit extra free with your sh
> 	and it still does what you expect.

Интересно.  Google показывает, что на самом деле всё ещё сложнее:

	Also on Digital Unix you may way to use /usr/bin/posix/sh rather
	than the DEC special bourne shell. Alternatively (from the man page):

	[Digital]  Subsequent shells spawned from the initial shell
	depend on the value in the environment variable BIN_SH.  If this
	variable is set to xpg4, the POSIX shell is started. If this
	variable is set to svr4, an SVR4 compliant version of the
	shell is started.  If this variable is unset, the Bourne shell
	is started. If this variable is set to any other value, an error
	is reported and the results are unpredicatable.

http://www.greatcircle.com/lists/majordomo-workers/mhonarc/majordomo-workers.199610/msg00159.html


	If you graft on some interactive productivity enhancements
	onto the Bourne shell, the result is the POSIX (Portable
	Operating System Interface) shell. The POSIX shell is very
	similar to the Korn shell in terms of the interactive features
	provided, right down to the keystroke in most cases. The Korn
	shell is not standardized, so there are annoying differences
	between various vendor's versions; the POSIX shell attempts to
	raise the bar for a universally available shell.

	The current POSIX shells are based on POSIX.2 of the IEEE
	POSIX Shell and Tools specification (IEEE Working Group
	1003.2). The POSIX shell is a superset of the Bourne shell.
...
	The POSIX shell offers many shortcuts, such as aliases, cd
	path searches, filename completion and job control.

http://216.239.59.104/search?q=cache:xXuCYqFChlsJ:www.unix.kg/eng/misc/unix_unleashed/page014.shtml+posix+shell+sh5

Короче SystemV shell (aka sh5) != Bourne shell != POSIX shell != Bash.

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [devel] Re: bash vs sh policy
  2003-10-08 15:23   ` [devel] " Alexey Tourbin
  2003-10-08 18:34     ` Dmitry Vukolov
@ 2003-10-09 20:34     ` Mikhail Zabaluev
  1 sibling, 0 replies; 12+ messages in thread
From: Mikhail Zabaluev @ 2003-10-09 20:34 UTC (permalink / raw)
  To: ALT Devel discussion list

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

Hello Alexey,

On Wed, Oct 08, 2003 at 07:23:57PM +0400, Alexey Tourbin wrote:
>
> Хорошо!  Вот полный список пакетов, которые просят bash.
> 
> bogofilter-contrib-0.14.5.4-alt1

Это contrib, и мне туда залезать не хочется.

> j2se1.4-sun-javaws-1.4.2_01-alt1

Если не виноват мой простенький скрипт, в котором нет bash,
то править их код нежелательно исходя из лицензии.

-- 
Stay tuned,
  MhZ                                     JID: mhz@altlinux.org
___________
A nuclear war can ruin your whole day.

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [devel] Re: shell peculiarity
  2003-10-09 10:02       ` Alexey Tourbin
  2003-10-09 15:36         ` Alexey Tourbin
@ 2003-10-14 13:18         ` Alexey Tourbin
  2003-10-14 14:19           ` Denis Ovsienko
  1 sibling, 1 reply; 12+ messages in thread
From: Alexey Tourbin @ 2003-10-14 13:18 UTC (permalink / raw)
  To: devel

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

On Thu, Oct 09, 2003 at 02:02:04PM +0400, Alexey Tourbin wrote:
> On Wed, Oct 08, 2003 at 10:34:40PM +0400, Dmitry Vukolov wrote:
> > Где можно почитать про стандартный shell и понимаемые им конструкции?
> > Достаточно ли тестирования на работоспособность с ash для определения,
> > что скрипт использует только стандартные возможности?
> 
> Вообще, со "стандартным шеллом" есть некоторый конфуз.  De facto
> стандартным шеллом считается чистый Bourne Shell, вещь вполоне себе

Вот заметил:

(zsh)
$ echo asdf | cat </dev/null
asdf
$

(bash)
$ echo asdf | cat </dev/null
$

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [devel] Re: shell peculiarity
  2003-10-14 13:18         ` [devel] Re: shell peculiarity Alexey Tourbin
@ 2003-10-14 14:19           ` Denis Ovsienko
  0 siblings, 0 replies; 12+ messages in thread
From: Denis Ovsienko @ 2003-10-14 14:19 UTC (permalink / raw)
  To: ALT Devel discussion list


> Вот заметил:
>
> (zsh)
> $ echo asdf | cat </dev/null
> asdf
> $
>
> (bash)
> $ echo asdf | cat </dev/null
> $
Разный приоритет операций перенаправления? Или вообще отсутствие
приоритета и чтение слева направо?

--
    DO4-UANIC


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2003-10-14 14:19 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-08 14:39 [devel] bash vs sh policy Alexey Tourbin
2003-10-08 14:41 ` [devel] " Michael Shigorin
2003-10-08 15:24 ` [devel] " Denis Ovsienko
2003-10-08 15:23   ` [devel] " Alexey Tourbin
2003-10-08 18:34     ` Dmitry Vukolov
2003-10-09  8:43       ` Dmitry V. Levin
2003-10-09 10:20         ` Alexey Tourbin
2003-10-09 10:02       ` Alexey Tourbin
2003-10-09 15:36         ` Alexey Tourbin
2003-10-14 13:18         ` [devel] Re: shell peculiarity Alexey Tourbin
2003-10-14 14:19           ` Denis Ovsienko
2003-10-09 20:34     ` [devel] Re: bash vs sh policy Mikhail Zabaluev

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