Bug #21367

DAQInterface product unsetup attempt not working

Added by John Freeman over 2 years ago. Updated over 2 years ago.

Target version:
Start date:
Due date:
% Done:


Estimated time:


This morning I determined that the command used by DAQInterface in Popen to unsetup products - i.e., sterilize the Popen environment - which I lifted from Ron, doesn't work in Popen since it uses a function, and functions don't actually make it into Popen. That is, the command

bash_unsetup_command="type unsetup && for pp in `printenv | sed -ne \"/^SETUP_/{s/SETUP_//;s/=.*//;p}\"`; do test $pp = UPS && continue; prod=`echo $pp | tr \"A-Z\" \"a-z\"`; unsetup -j $prod; done || echo 0" 

is essentially a no-op, since the "unsetup" function will always be undefined, even if it's defined in the shell calling DAQInterface. So what I've done in the commit on the develop branch listed right below this comment is defined the unsetup function in situ:
bash_unsetup_command="upsname=$( which ups ); if [[ -n $upsname ]]; then unsetup() { . `$upsname unsetup \"$@\"` ; }; for pp in `printenv | sed -ne \"/^SETUP_/{s/SETUP_//;s/=.*//;p}\"`; do test $pp = UPS && continue; prod=`echo $pp | tr \"A-Z\" \"a-z\"`; unsetup -j $prod; done; echo \"After bash unsetup, products active (should be nothing but ups listed):\"; ups active; else echo \"ups does not appear to be set up; will not unsetup any products\"; fi" 

As an example of the previous behavior of DAQInterface, if one set the debug level in the boot file to 3, and then set up a package with a different version than that set up by the daq setup script (e.g., setupARTDAQDEMO), then warnings like the following would appear:
Error encountered when setting up product: art
ERROR: Version conflict -- dependency tree requires versions conflicting with current setup of product gcc: version v6_4_0 vs v4_9_3a

proving that the previous bash_unsetup_command wasn't working. With the new bash_unsetup_command, these errors go away, and the DAQ runs smoothly.

Associated revisions

Revision 3c42296e (diff)
Added by John Freeman over 2 years ago

JCF: fixed the ups product unsetup command due to a bug based on how Popen handles bash functions; see Issue #21367


#1 Updated by John Freeman over 2 years ago

Fix implemented in commit 3c42296e51a694d3ff42ad44339679ae7da04a96 on the develop branch

Also available in: Atom PDF