Public bug reported:

Binary package hint: ubuntu-vm-builder

If I run ubuntu-vm-builder in intrepid as root (via sudo in some form)
it fails if the current directory is not writable for the $SUDO_USER

This is because of:

set +e
if [ -n "${SUDO_USER}" ]; then
        sudo -u "${SUDO_USER}" mkdir "${DESTINATION}"
else
        mkdir "${DESTINATION}"
fi

If it wants to be clever, then it could be clever about this case as
well, so something like:

if [ -n "${SUDO_USER}" ]; then
        if ! sudo -u "${SUDO_USER}" mkdir "${DESTINATION}"; then
             mkdir "${DESTINATION}"
        fi 
else
        mkdir "${DESTINATION}"
fi

is probably more appropriate.

** Affects: ubuntu-vm-builder (Ubuntu)
     Importance: Undecided
         Status: New

** Description changed:

  Binary package hint: ubuntu-vm-builder
  
  If I run ubuntu-vm-builder in intrepid as root (via sudo in some form)
- it fails if the current directory is not writable.
+ it fails if the current directory is not writable for the $SUDO_USER
  
  This is because of:
  
  set +e
  if [ -n "${SUDO_USER}" ]; then
          sudo -u "${SUDO_USER}" mkdir "${DESTINATION}"
  else
          mkdir "${DESTINATION}"
  fi
  
  If it wants to be clever, then it could be clever about this case as
  well, so something like:
  
  if [ -n "${SUDO_USER}" ]; then
          if ! sudo -u "${SUDO_USER}" mkdir "${DESTINATION}"; then
               mkdir "${DESTINATION}"
          fi 
  else
          mkdir "${DESTINATION}"
  fi
  
  is probably more appropriate.

-- 
fails mysterious when runs as root (via sudo)
https://bugs.launchpad.net/bugs/255674
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to