I had some comments from the other bug reports I file which led me to do some more testing. Here's what I found.

I've had three packages with this issue - spamassassin, sa-compile and tuptime.

The user for spamassassin and sa-compile is debian-spamd whose shell is set to /bin/sh. The user for tuptime is tuptime whose shell is also set to /bin/sh. No other users on my system use /bin/sh.

Changing the shell to /bin/bash for tuptime for example, eliminates the error with using 'su -'.

Aliases present no problem. Functions, depending on how they are written, do.

function somefunction () {....} causes a problem.

function somefunction {....} causes a problem.

somefunction () {....} does not. Using the reserved word 'function' causes /bin/sh to throw an error.

Interestingly, when using the reserved word function, the presence of () changes the error message.

With the use of ():
-sh: 5: /etc/profile.d/test.sh: Syntax error: "(" unexpected (expecting "fi")

Without the use of ():
-sh: 5: /etc/profile.d/test.sh: function: not found

Definitely would have been much easier to spot the error had we not used ().

So while calling a login shell caused a problem, ultimately, it's because /bin/sh does not recognise the reserved word 'function'. I'm not sure there's a good solution for this. It seems to be such a specific issue. Had I not created a user with a /bin/sh shell and tried to recreate the function for that user, I'm not sure I would have twigged that the reserved word function was causing the problem since the error kept coming back as the ( causing the issue.

Thanks.

--
Terry

Reply via email to