This is the mail archive of the mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: astksh review

> > > Now that we have the real, honest-to-goodness ksh, do we 
> really need
> > > pdksh? Just a suggestion...
> > >
> >
> > I totally agree, there is no reason why pdksh should be the 
> default ksh.
> >   Let users make the symlink themselves.  We should always 
> allow "The
> > Real Thing" to trump some knockoff...
> >
> > [Still trying to dig out from under a backlog...]
> If the user has installed pdksh before, and now wants ksh93 to be his
> default ksh, he can remove the symlink himself before 
> installing astksh
> (this might merit a mention in the release notes).

This is the postinstall script I'm going to put in the astksh package:

		if [ ! -e /bin/ksh.exe ]; then
		    ln -s ksh93.exe /bin/ksh.exe
		    echo "/bin/ksh.exe already exists"
		if [ ! -e /usr/man/man1/ksh.1 ]; then
		    ln -s ksh93.1 /usr/man/man1/ksh.1
		    echo "/usr/man/man1/ksh.1 already exists"
		if [ -f /etc/shells ]; then
		    for i in /bin/ksh93 /bin/ksh /usr/bin/ksh93
		        if ! grep $i /etc/shells >/dev/null 2>&1; then
		          echo $i >> /etc/shells
			    echo "$i added to /etc/shells"
			    echo "$i already in /etc/shells"
		    echo "no /etc/shells file"
		exit 0

I have no idea if this is cygwinly correct, I took the pdksh postinstall
for an example.

> However, this brings a valid point: suppose a user wants to 
> switch, and
> uninstalls the pdksh package.  The symlink will still be 
> there (although
> it will be broken).  So, when the user installs astksh, he will have a
> broken /bin/ksh symlink pointing to a nonexistent pdksh.exe.
> Perhaps the postinstall script should be smarter, and check 
> not only that
> the link exists, but also that it's valid, and if it isn't, 
> replace it.

You mean something like this:

		if [ -L /bin/ksh.exe -a ! /bin/ksh.exe -ef
/bin/pdksh.exe ]; then
			rm -f /bin/ksh.exe
			ln -s ksh93.exe /bin/ksh.exe

Ugly, because the pdksh and ksh93 and eventually Peter Brutzelmann's
KornShell clone maintainers have to communicate.

OK, I can live with this as long as we don't have any other ksh.exe
candidates besides pdksh and ksh93 :)
I already put some pdksh info into the astksh README.

BTW, the above won't work anyway with the .exe suffix, you'll run into
one of cygwin's bogosities:
(Suppose you got vim installed, /bin/vi is a symbolic link to /bin/vim)

$ if [ /bin/vi.exe -ef /bin/vim.exe ]; then echo yo; fi
$ if [ /bin/vi -ef /bin/vim ]; then echo yo; fi

I'll leave this as an exercise to the cygwin kernel hackers. I must not
do cygwin kernel hacking anymore, since I had a chance to glimpse at the
uwin code and thus am tainted.


P.S.: The package update might take some more time, some bugs showed up.
I guess I can update next Thursday.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]