adt-run fails with permission denied with option --user

Bug #1084116 reported by Dimitri John Ledkov
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Auto Package Testing
Fix Released
Undecided
Jean-Baptiste Lallement
autopkgtest (Debian)
Fix Released
Unknown
autopkgtest (Ubuntu)
Fix Released
High
Dimitri John Ledkov

Bug Description

Imported from Debian bug http://bugs.debian.org/686292:

Package: autopkgtest
Version: 2.2.3
Severity: normal

With option --user, adt-run fails with permission denied when it creates
tmpdir

The issue is that the top level temporary directory is owned by root
with permission 0700

Below the output of adt-run for postgresql-common:

$ sudo adt-run -d --leave-lang --unbuilt-tree . --user=ubuntu ---
adt-virt-null

adt-run: trace1: options: <Values at 0x9207ccc: {'set_lang': False,
'timeout_install': None, 'binaries_fortests': 'auto', 'actions':
[<Action ubtree ubtree0 <AF@ubtree0-ubtree~.:./!|-/>>], 'VSERVER_DUMMY':
None, 'unbuilt_tree': None, 'timeout_test': None, 'tmp': None, 'binary':
None, 'timeout_factor': 1.0, 'timeout_short': None, 'vserver':
['adt-virt-null'], 'source': None, 'output_dir': None, 'debuglevel': 1,
'gainroot': None, 'timeout_build': None, 'built_binaries_filter': None,
'user': 'ubuntu', 'logfile': None, 'override_control': None,
'gnupghome': '~/.autopkgtest/gpg', 'quiet': False, 'summary': None,
'built_tree': None, 'binaries': 'auto', 'binaries_forbuilds': 'auto'}>;
timeouts: {'test': 10000, 'short': 100, 'build': 100000, 'install': 3000}
adt-run: trace: ** init
adt-run: trace: ** start
adt-run: trace: $ vserver: adt-virt-null
adt-run: trace: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ starting
adt-run: trace: ** open, scratch=None
adt-run: trace: ** cmdl = ['sh', '-c', 'exec "$@"', 'x']
adt-run: trace: * initialising
adt-run: trace: * no key generation needed
adt-run: trace: * reset
adt-run: trace: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ builds ...
adt-run: trace: @@@@@@@@@@@@@@@@@@@@ ubtree ubtree0
adt-run: trace1: ** blame += arg:.
adt-run: trace1: ** prepare1, modified=False, deps_processed=[], deps_new=[]
adt-run: trace1: ** needs_reset, previously=False
adt-run: trace: $ ubtree0-extract: sh -ec <SCRIPT> x
/tmp/tmp.8kHsrdmpjH/ubtree0-build/tmpdir
/tmp/tmp.8kHsrdmpjH/ubtree0-build/real-tree
adt-run: trace1: $ exec 3>&1 >&2
adt-run: trace1: $ set -x
adt-run: trace1: $ spec="$2"
adt-run: trace1: $ origpwd=`pwd`
adt-run: trace1: $ cd /tmp/tmp.8kHsrdmpjH/ubtree0-build
adt-run: trace1: $ chown ubuntu .
adt-run: trace1: $ TMPDIR="$1"
adt-run: trace1: $ rm -rf -- "$TMPDIR"
adt-run: trace1: $ export TMPDIR
adt-run: trace1: $ su ubuntu -c 'mkdir -- "$TMPDIR"'
adt-run: trace1: $ spec="$spec" origpwd="$origpwd" su ubuntu -c '
adt-run: trace1: $ rm -rf "$spec"
adt-run: trace1: $ mkdir "$spec"
adt-run: trace1: $ cp -rP
--preserve=timestamps,links -- "$origpwd"/. "$spec"/.
adt-run: trace1: $ '
adt-run: trace1: $ cd [a-z0-9]*-*/.
adt-run: trace1: $ pwd >&3
adt-run: trace1: $ set +e; test -f debian/tests/control; echo $? >&3
+ spec=/tmp/tmp.8kHsrdmpjH/ubtree0-build/real-tree
+ pwd
+ origpwd=/tmp/tmp.8kHsrdmpjH/ubtree0-ubtree
+ cd /tmp/tmp.8kHsrdmpjH/ubtree0-build
+ chown ubuntu .
+ TMPDIR=/tmp/tmp.8kHsrdmpjH/ubtree0-build/tmpdir
+ rm -rf -- /tmp/tmp.8kHsrdmpjH/ubtree0-build/tmpdir
+ export TMPDIR
+ su ubuntu -c mkdir -- "$TMPDIR"
mkdir: cannot create directory
`/tmp/tmp.8kHsrdmpjH/ubtree0-build/tmpdir': Permission denied
blame: arg:.
badpkg: rules extract failed with exit code 1
adt-run: erroneous package: rules extract failed with exit code 1
adt-run: trace: ** stop
adt-run: trace: ** close,
scratch=tb-scratch~/tmp/tmp.8kHsrdmpjH:-/|/tmp/tmp.8kHsrdmpjH/!

Changed in autopkgtest (Debian):
importance: Undecided → Unknown
Changed in auto-package-testing:
status: New → Confirmed
Changed in autopkgtest (Ubuntu):
status: New → In Progress
assignee: nobody → Dmitrijs Ledkovs (xnox)
importance: Undecided → High
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

autopkgtest (2.2.3ubuntu1) raring; urgency=low

  * Fix adt-run's user option fails with permission denied. (LP: 1084116) (Closes: #686292)

Changed in autopkgtest (Ubuntu):
status: In Progress → Fix Released
Revision history for this message
Martin Pitt (pitti) wrote :

I merged Dmitrijs' auto-package-testing fix (with a slight change), needs deployment now.

Changed in auto-package-testing:
assignee: nobody → Jean-Baptiste Lallement (jibel)
status: Confirmed → Fix Committed
Martin Pitt (pitti)
Changed in auto-package-testing:
status: Fix Committed → Fix Released
Changed in autopkgtest (Debian):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.