jobs running as root can't use ${CHECKBOX_DATA}

Bug #1049595 reported by Sylvain Pineau
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Checkbox
Fix Released
Medium
Brendan Donegan

Bug Description

A couple of jobs including cpu/scaling_test and stress/graphics build their log path with CHECKBOX_DATA, e.g:

graphics_stress_test -d -o $CHECKBOX_DATA/graphics-stress-results
fwts_test -c -l ${CHECKBOX_DATA}/scaling_test.log

But as they are executed with the root user, these logs are not created as expected in ~.checkbox or ~.cache/checkbox but at the root of the filesystem: /

drwxr-xr-x 24 root 4096 Sep 12 12:19 ./
drwxr-xr-x 24 root 4096 Sep 12 12:19 ../
drwxr-xr-x 2 root 4096 Aug 3 08:53 bin/
drwxr-xr-x 3 root 4096 Sep 11 09:16 boot/
drwxr-xr-x 2 root 4096 May 27 14:20 cdrom/
-rw-r--r-- 1 root 4090 Jun 20 09:10 cpu_scaling_test.log
drwxr-xr-x 17 root 4560 Sep 12 10:09 dev/
drwxr-xr-x 153 root 12288 Sep 12 10:11 etc/
-rw-r--r-- 1 root 72 Sep 12 12:11 graphics-stress-results
[...]
lrwxrwxrwx 1 root 33 Sep 11 09:15 initrd.img -> /boot/initrd.img-3.2.0-30-generic
lrwxrwxrwx 1 root 33 Aug 10 09:19 initrd.img.old -> /boot/initrd.img-3.2.0-29-generic
[...]
-rw-r--r-- 1 root 4243 Sep 12 12:21 scaling_test.log
[...]
lrwxrwxrwx 1 root 29 Sep 11 09:15 vmlinuz -> boot/vmlinuz-3.2.0-30-generic
lrwxrwxrwx 1 root 29 Aug 10 09:19 vmlinuz.old -> boot/vmlinuz-3.2.0-29-generic

These files are also use for attachments and we expect to find them in CHECKBOX_DATA, the user env var.

Related branches

description: updated
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

Probably related to how we use sudo. The fix is probably sudo -E or explicit whitelist of the CHECKBOX_ variables by shipping appropriate entry in /etc/sudoers.d/

Revision history for this message
Brendan Donegan (brendan-donegan) wrote :

A similar issue was fixed before in the fwts_test itself. The solution is to include CHECKBOX_DATA in the environ: field of the job - anyway I will submit a quick fix

Changed in checkbox:
status: New → In Progress
importance: Undecided → Medium
assignee: nobody → Brendan Donegan (brendan-donegan)
Revision history for this message
Daniel Manrique (roadmr) wrote :

Yes, just to confirm that to avoid messing up with sudo configuration, the recommended solution is to add environ: CHECKBOX_DATA to jobs.

Changed in checkbox:
status: In Progress → Fix Committed
Changed in checkbox:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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