Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] Re: Problems with exit-states (now VDR-1.2.4)



On Wed, 3 Sep 2003, Steffen Barszus (SB) wrote:

SB>
SB> [root@localhost init.d]# su -c "vdr -t /dev/tty11 ; echo $?" root
SB> passed line 324
SB> passed line 326
SB> 0    <== Exitcode  with _"_
SB>
SB> [root@localhost init.d]# su -c 'vdr -t /dev/tty11; echo $?' root
SB> passed line 324
SB> passed line 326
SB> 2   <== Exitcode with _'_
SB>


the thing is that in the first case $? is replaced by the shell with the
return status of the previous (!!!) command, which is not in your email.

in the second case, $? is passed to su as it is. and is replaced by the
shell, which is run by su.

as you can see here:

# echo $UID
500
# su -c "echo $UID"
Password:
500
# su -c 'echo $UID'
Password:
0

in the second and the third cases, the echo Program is run by the user
root. but in second case,
  echo 500
is run by root, where in the third case
  echo $UID
is run by root.

Thus,  I  would _STRONGLY_ suggest to look for exit codes of VDR _WITHOUT_
using  su  or  sudo or things like that. Once this works (or if this works
already),  you  can start using programs like su or sudo and see that they
pass correct return values to outside:

# su -c '(exit 14)'
Password:
# echo $?
142

# sudo bash -c '(exit 14)'
Password:
# echo $?
14

here 142 is the return value of su, which is NOT the return value of the
subsequent shell.

where 14 as the return value of sudo is exactly the return value of the
command ran by sudo.

Hope that helps a bit to track the real problem.

        Sergei
-- 
--------------------------------------------------------------------  -?)
         eMail:       Sergei.Haller@math.uni-giessen.de               /\\
-------------------------------------------------------------------- _\_V
Be careful of reading health books, you might die of a misprint.
                -- Mark Twain



-- 
Info:
To unsubscribe send a mail to ecartis@linuxtv.org with "unsubscribe vdr" as subject.



Home | Main Index | Thread Index