package lint suggestions

Brian Dessent
Sat May 3 01:56:00 GMT 2008

"Yaakov (Cygwin Ports)" wrote:

> | - contains postinstall/preremove script without requiring bash (this
> | matters for the order in which scripts are run)
> Isn't that an overkill; bash is in Base, after all.

It matters for the order that the postinstall scripts are run, because
that order is determined by the topo sort on the 'requires:'.

The bash package installs /bin/bash.exe and copies that to /bin/sh.exe
in its postinstall if there is not already a /bin/sh.exe that isn't
ash.  This means if you simultaneously install bash and some other
package that has a postinstall script (as during a new installation),
and if that other package doesn't list bash in the 'requires', then
there is a chance that the other package's postinstall will be run
before bash's postinstall, and consequently that postinstall will fail
with "invalid interpreter" if it starts with "#!/bin/sh" as postinstalls
are always invoked with "/bin/bash -c" which honors the shebang.  But if
the package 'requires:' bash then its postinstall will always be run
after bash's postinstall, avoiding the issue.

We have historically lucked out here for several reasons:

- many postinstalls don't have a shebang, or explicitly list #!/bin/bash
- outside of the case of a fresh new install, /bin/sh tends to always
- the bash postinstall tends to be near the front of the topo order

(So I suppose technically the lint rule should be that if you have a
postinstall that stats with "#!/bin/sh" you must 'require:' bash.)

Alternatively, if bash were to directly install both /bin/bash and
/bin/sh instead of copying the latter in a postinstall then we would no
longer have this requirement.


More information about the Cygwin-apps mailing list