Closed dmitrijus closed 7 years ago
Another easy "work-around" is to use script(1):
exec script /dev/null
"script" is a command which captures (to a file, which is /dev/null in our case) anything you type and output, but more importantly, it has to reopen the stdin/out/err in order to capture them (and they are created with correct permissions).
Dmitrijus
Thanks for reporting this. Can you please specify why you were running git cms-addpkg via sudo / cron? In principle git-cms-* are for interactive usage and you are much better off using normal git commands if you need to do things non interactively. Of course if you have a patch for this it will not be rejected though.
In online dqm we run our stuff inside a special dqmdev/dqmpro user, and we usually set up cmssw inside interactively via sudo bash.
Our code is changing quite often and the git tools are quite useful. I won't make a patch (for now), running under "script" solves the problem.
As for cron - I do not use it, but I remember Antanas and several summer students complaining about this bug.
Partially addressed by #78 .
A new Issue was created by @dmitrijus Dmitrijus.
@davidlange6, @smuzaffar, @Dr15Jones can you please review it and eventually sign/assign? Thanks.
cms-bot commands are listed here cms-sw/cmssw#13029
@dmitrijus is this still an issue ?
I did a quick check it and it seems to work fine. Thanks.
Hi,
The scripts should not use /dev/stderr for redirection, It's a bad practice and it causes troubles for sudo/cron/whatever users (Permission denied).
This happens because:
are different - the later will try to open a file named /dev/stderr and it will fail, because the sudo user does not have the access rights to the pts. In other words, &2 can be duplicated and written to it, but it cannot be re-openned.
The "workaround" is to run the scripts either with -q option, or create virtual stdin/stdout via redirection:
git-cms-init -ssh 2>&1 | cat
.Ideally, scripts should never open /dev/stderr or /dev/stdout, but if the redirection is necessary, it should be done via exec:
echo a >somefile
should becomeexec >somefile; echo a
or if some special stream is necesarry,exec 5>test; echo "hello" >&5
I can modify the scripts to remove "git-command >DEBUG_STREAM" style redirections, reimplement "-q" and similar options via "exec 1> /dev/null". That might change the output and I have no idea whether it won't break other scripts.
Dmitrijus