Bug 5690 - Lack of sanity check for TMPDIR
Summary: Lack of sanity check for TMPDIR
Status: RESOLVED WONTFIX
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: core (show other bugs)
Version: 1.5
Hardware: x86 Multiple
: Medium normal
Target Milestone: 1.7
Assignee: Chen Qi
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2013-12-27 06:15 UTC by Chen Qi
Modified: 2014-07-03 07:40 UTC (History)
5 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chen Qi 2013-12-27 06:15:19 UTC
Our build system uses a lot of tools and hence have more restrictions on paths than what we might expect.

Here's an example.
If we set in local.conf:
TMPDIR = "/home/chenqi/poky/build-systemd/tmp-no-empty-dev/"
(Pretty reasonable path at a first glance, right?)

We would get the following error.
     ERROR: debugedit failed with exit code 256 (cmd was '/home/chenqi/poky/build-systemd/tmp-no-empty-dev//sysroots/i686-linux/usr/lib/rpm/bin/debugedit' -b '/home/chenqi/poky/build-systemd/tmp-no-empty-dev\
//work/i586-poky-linux' -d '/usr/src/debug' -i -l '/home/chenqi/poky/build-systemd/tmp-no-empty-dev//work/i586-poky-linux/gcc-runtime/4.8.2-r0/debugsources.list' '/home/chenqi/poky/build-systemd/tmp-no-empty\
-dev//work/i586-poky-linux/gcc-runtime/4.8.2-r0/package/usr/lib/libgomp.so.1.0.0'):
     /home/chenqi/poky/build-systemd/tmp-no-empty-dev/sysroots/i686-linux/usr/lib/rpm/bin/debugedit: canonicalization unexpectedly shrank by one character
     ERROR: Function failed: split_and_strip_files
     ERROR: Logfile of failure stored in: /home/chenqi/poky/build-systemd/tmp-no-empty-dev//work/i586-poky-linux/gcc-runtime/4.8.2-r0/temp/log.do_package.7625
     ERROR: Task 731 (/home/chenqi/poky/meta/recipes-devtools/gcc/gcc-runtime_4.8.bb, do_package) failed with exit code '1'

This is because the debugedit tool doesn't like double slashes.
And this puts a restriction on our TMPDIR, that is, the TMPDIR cannot end with trailing slashes.

Compared to having our users stair at the screen trying to figure out what's going on, I think it's better that we output informative error messages early.

That's why a sanity check for TMPDIR is needed.

For now, I'd like to propose the following regexp for our TMPDIR:
^/[a-zA-Z0-9\-_/.~]*[a-zA-Z0-9\-_.~]$

The above regexp implies:
1) TMPDIR must be an absolute path
2) TMPDIR must not contain special chars like # or @.
3) TMPDIR cannot end with trailing slashes.

//Chen Qi
Comment 1 Chen Qi 2014-07-03 07:40:05 UTC
Close this bug as 'WONT FIX' as people don't care about this issue, althought related patches have been sent to the mailing list.