<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>7922</bug_id>
          
          <creation_ts>2015-06-24 22:25:32 +0000</creation_ts>
          <short_desc>Sanity test that files can be created in TMPDIR</short_desc>
          <delta_ts>2015-11-04 11:47:11 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>core</component>
          <version>1.9</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>VERIFIED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>1.9 M2</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Ross Burton">ross.burton</reporter>
          <assigned_to name="Mariano Lopez">mariano.lopez</assigned_to>
          <cc>anibal.limon</cc>
    
    <cc>bluelightning</cc>
    
    <cc>bogdanx.a.voiculescu</cc>
    
    <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
          
          <qa_contact name="Daniel Istrate">daniel.alexandrux.istrate</qa_contact>
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>51919</commentid>
    <comment_count>0</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2015-06-24 22:25:32 +0000</bug_when>
    <thetext>If /tmp can&apos;t be written to for whatever reason (say, no tmpfs and / is full up) then bitbake gives a very obscure error:

ERROR:  OE-core&apos;s config sanity checker detected a potential misconfiguration.
    Either fix the cause of this error or at your own risk disable the checker (see sanity.conf).
    Following is the list of potential problems / advisories:

    Your gcc version is older than 4.5 or is not working properly.  Please verify you can build and link something that uses atomic operations, such as: 
        __sync_bool_compare_and_swap (&amp;atomic, 2, 3);


(as gcc fails to write temporary files)

We should probably check that we can write a small file into $TMP as a very early sanity test before compiling.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>52013</commentid>
    <comment_count>1</comment_count>
    <who name="Mariano Lopez">mariano.lopez</who>
    <bug_when>2015-06-29 15:26:31 +0000</bug_when>
    <thetext>The check must be done in /tmp (not TMPDIR)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>52014</commentid>
    <comment_count>2</comment_count>
    <who name="Mariano Lopez">mariano.lopez</who>
    <bug_when>2015-06-29 15:27:11 +0000</bug_when>
    <thetext>Sent patch for review</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>52177</commentid>
    <comment_count>3</comment_count>
    <who name="Mariano Lopez">mariano.lopez</who>
    <bug_when>2015-07-07 15:38:40 +0000</bug_when>
    <thetext>This bug has been fixed with commit:

http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=cea20425a3dcb8868c53518cbec4b250076f1675</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>52182</commentid>
    <comment_count>4</comment_count>
    <who name="Mariano Lopez">mariano.lopez</who>
    <bug_when>2015-07-07 16:19:47 +0000</bug_when>
    <thetext>Adding the comments from Ross

    +    # Check if /tmp is writable
    +    from string import ascii_letters
    +    from random import choice
    +    filename = &quot;bb_writetest.%s&quot; % os.getpid()
    +    testfile = os.path.join(&quot;/tmp&quot;, filename)


Use tempfile.mkstemp() here, we&apos;ll get proper unique names and it will use the same temporary directory as gcc etc.
 

    +    try:
    +        f = open(testfile, &quot;w&quot;)
    +        f.write(&quot;&quot;.join(choice(ascii_letters) for x in range(1024)))
    +        f.close()
    +        os.remove(testfile)
    +    except:
    +        status.addresult(&quot;Failed to write into /tmp. Please verify your filesystem.&quot;)


The error should include the message from the exception to help root-cause the problem.

Ross</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>52192</commentid>
    <comment_count>5</comment_count>
    <who name="Mariano Lopez">mariano.lopez</who>
    <bug_when>2015-07-07 19:26:37 +0000</bug_when>
    <thetext>Sent patch v2 based on master for review</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>52520</commentid>
    <comment_count>6</comment_count>
    <who name="Mariano Lopez">mariano.lopez</who>
    <bug_when>2015-07-22 14:04:25 +0000</bug_when>
    <thetext>This bug has been solved with commit:

http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=45772bab329821ad425b20e630749c2a6c82c235</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>56093</commentid>
    <comment_count>7</comment_count>
    <who name="Paul Eggleton">bluelightning</who>
    <bug_when>2015-11-02 14:53:25 +0000</bug_when>
    <thetext>FYI the fix mentioned above was reverted in favour of this one:

http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=9f87dcf3a3adf0b215b59eac854d372216c9dc0d</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>56098</commentid>
    <comment_count>8</comment_count>
    <who name="Daniel Istrate">daniel.alexandrux.istrate</who>
    <bug_when>2015-11-02 16:00:18 +0000</bug_when>
    <thetext>Verified on master: 370a2916c4559c17952392b872322e8e490b124c

As far as I can tell this bug was fixed and then the fix was removed in favor of http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=9f87dcf3a3adf0b215b59eac854d372216c9dc0d.

That fix only checks that /tmp has enough space. It does not check proper /tmp permissions.
So the case when you cannot create a file in /tmp due to wrong permissions is not covered.


**************** Test 1: change /tmp permissions to 555

[daniel@fedora-ws poky-build2]$ sudo chmod 555 /tmp
[daniel@fedora-ws poky-build2]$ bitbake ed
Parsing recipes: 100% |##############################################################################| ETA:  00:00:00
Parsing of 900 .bb files complete (0 cached, 900 parsed). 1330 targets, 38 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies

Build Configuration:
BB_VERSION        = &quot;1.28.0&quot;
BUILD_SYS         = &quot;x86_64-linux&quot;
NATIVELSBSTRING   = &quot;Fedora-21&quot;
TARGET_SYS        = &quot;i586-poky-linux&quot;
MACHINE           = &quot;qemux86&quot;
DISTRO            = &quot;poky&quot;
DISTRO_VERSION    = &quot;2.0&quot;
TUNE_FEATURES     = &quot;m32 i586&quot;
TARGET_FPU        = &quot;&quot;
meta              
meta-yocto        
meta-yocto-bsp    = &quot;master:370a2916c4559c17952392b872322e8e490b124c&quot;

NOTE: Preparing RunQueue
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
ERROR: autoreconf execution failed.
ERROR: Function failed: do_configure (log file is located at /media/ssd/poky-build2/tmp/work/x86_64-linux/gperf-native/3.0.4-r0/temp/log.do_configure.26594)
ERROR: Logfile of failure stored in: /media/ssd/poky-build2/tmp/work/x86_64-linux/gperf-native/3.0.4-r0/temp/log.do_configure.26594
Log data follows:
| DEBUG: Executing python function sysroot_cleansstate
| DEBUG: Python function sysroot_cleansstate finished
| DEBUG: Executing shell function autotools_preconfigure
| DEBUG: Shell function autotools_preconfigure finished
| DEBUG: Executing python function autotools_copy_aclocals
| DEBUG: SITE files [&apos;endian-little&apos;, &apos;common-linux&apos;, &apos;common-glibc&apos;, &apos;bit-64&apos;, &apos;x86_64-linux&apos;, &apos;common&apos;]
| DEBUG: Python function autotools_copy_aclocals finished
| DEBUG: Executing shell function do_configure
| automake (GNU automake) 1.15
| Copyright (C) 2014 Free Software Foundation, Inc.
| License GPLv2+: GNU GPL version 2 or later &lt;http://gnu.org/licenses/gpl-2.0.html&gt;
| This is free software: you are free to change and redistribute it.
| There is NO WARRANTY, to the extent permitted by law.
| 
| Written by Tom Tromey &lt;tromey@redhat.com&gt;
|        and Alexandre Duret-Lutz &lt;adl@gnu.org&gt;.
| AUTOV is 1
| NOTE: Executing ACLOCAL=&quot;aclocal --system-acdir=/media/ssd/poky-build2/tmp/work/x86_64-linux/gperf-native/3.0.4-r0/build/aclocal-copy/&quot; autoreconf --verbose --install --force --exclude=autopoint -I /media/ssd/poky-build2/tmp/work/x86_64-linux/gperf-native/3.0.4-r0/gperf-3.0.4
| autoreconf: cannot create /tmp/ar825.27062: Permission denied
|  at /media/ssd/poky-build2/tmp/sysroots/x86_64-linux/usr/bin/autoreconf line 732.
| ERROR: autoreconf execution failed.
| ERROR: Function failed: do_configure (log file is located at /media/ssd/poky-build2/tmp/work/x86_64-linux/gperf-native/3.0.4-r0/temp/log.do_configure.26594)
ERROR: Task 292 (virtual:native:/home/daniel/poky/meta/recipes-extended/gperf/gperf_3.0.4.bb, do_configure) failed with exit code &apos;1&apos;
NOTE: Tasks Summary: Attempted 147 tasks of which 120 didn&apos;t need to be rerun and 1 failed.
Waiting for 0 running tasks to finish:

Summary: 1 task failed:
  virtual:native:/home/daniel/poky/meta/recipes-extended/gperf/gperf_3.0.4.bb, do_configure
Summary: There were 2 ERROR messages shown, returning a non-zero exit code.

Revert back /tmp permissions
[daniel@fedora-ws poky-build2]$ sudo chmod 1777 /tmp


**************** Test 2: change /tmp size to less that 100MB (the fix mentioned in Comment 7)

[daniel@fedora-ws poky-build2]$ sudo mount -o remount,size=90m,noatime /tmp
[daniel@fedora-ws poky-build2]$ bitbake -c clean ed
Loading cache: 100% |################################################################################| ETA:  00:00:00
Loaded 1331 entries from dependency cache.
NOTE: Resolving any missing task queue dependencies

Build Configuration:
BB_VERSION        = &quot;1.28.0&quot;
BUILD_SYS         = &quot;x86_64-linux&quot;
NATIVELSBSTRING   = &quot;Fedora-21&quot;
TARGET_SYS        = &quot;i586-poky-linux&quot;
MACHINE           = &quot;qemux86&quot;
DISTRO            = &quot;poky&quot;
DISTRO_VERSION    = &quot;2.0&quot;
TUNE_FEATURES     = &quot;m32 i586&quot;
TARGET_FPU        = &quot;&quot;
meta              
meta-yocto        
meta-yocto-bsp    = &quot;master:370a2916c4559c17952392b872322e8e490b124c&quot;

NOTE: Preparing RunQueue
NOTE: Executing RunQueue Tasks
WARNING: The free space of /tmp (tmpfs) is running low (0.087GB left)
ERROR: No new tasks can be executed since the disk space monitor action is &quot;STOPTASKS&quot;!
NOTE: Tasks Summary: Attempted 1 tasks of which 0 didn&apos;t need to be rerun and all succeeded.

Summary: There was 1 WARNING message shown.
Summary: There was 1 ERROR message shown, returning a non-zero exit code.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>56145</commentid>
    <comment_count>9</comment_count>
    <who name="Mariano Lopez">mariano.lopez</who>
    <bug_when>2015-11-03 15:20:23 +0000</bug_when>
    <thetext>This bug was opened because /tmp was running out of space in the autobuilders. With the patch that Paul mentioned this is being monitored during all the build. I think if you can&apos;t write in /tmp, there would be other major problems than running bitbake</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>56175</commentid>
    <comment_count>10</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2015-11-04 11:21:37 +0000</bug_when>
    <thetext>I think I agree with Mariano here - if /tmp isn&apos;t writable at all then you&apos;ll be having far greater problems than bitbake not working: I&apos;d be surprised if you can even login.  We should sanity check the environment but not check for catastrophic failure.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>56176</commentid>
    <comment_count>11</comment_count>
    <who name="Daniel Istrate">daniel.alexandrux.istrate</who>
    <bug_when>2015-11-04 11:47:11 +0000</bug_when>
    <thetext>Checking if /tmp has sufficient free space is enough.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>