<?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>10783</bug_id>
          
          <creation_ts>2016-12-11 22:49:21 +0000</creation_ts>
          <short_desc>wic should not be writing out to /var/tmp/wic</short_desc>
          <delta_ts>2017-02-02 14:06:17 +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>Scripts and Tools</component>
          <version>2.2</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>minor</bug_severity>
          <target_milestone>2.3 M3</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Paul Eggleton">bluelightning</reporter>
          <assigned_to name="Ed Bartosh">eduard.bartosh</assigned_to>
          <cc>brian.avery</cc>
    
    <cc>mikko.ylinen</cc>
    
    <cc>olev.kartau</cc>
    
    <cc>ross.burton</cc>
    
    <cc>sgw</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>Yes (doc changes required)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>69020</commentid>
    <comment_count>0</comment_count>
    <who name="Paul Eggleton">bluelightning</who>
    <bug_when>2016-12-11 22:49:21 +0000</bug_when>
    <thetext>wic by default wants to write to /var/tmp/wic. Hardcoding this slightly unusual temp path doesn&apos;t seem right to me, and in any case it breaks if two users try to write to it - the first one that creates it will own it preventing the second from writing to it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>69030</commentid>
    <comment_count>1</comment_count>
    <who name="Ed Bartosh">eduard.bartosh</who>
    <bug_when>2016-12-12 11:39:33 +0000</bug_when>
    <thetext>I can fix it by making specifying output directory mandatory.
However, it can hurt users who run wic without -o option and expect results in /var/tmp/wic

Do you have a better idea how to fix this?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>69155</commentid>
    <comment_count>2</comment_count>
    <who name="brian avery">brian.avery</who>
    <bug_when>2016-12-15 15:42:12 +0000</bug_when>
    <thetext>what about using mktemp?

i.e. write to /var/tmp/wic-XXX

via mktemp -d --tmpdir=/var/tmp wic-XXXX</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>69178</commentid>
    <comment_count>3</comment_count>
    <who name="Paul Eggleton">bluelightning</who>
    <bug_when>2016-12-15 20:22:48 +0000</bug_when>
    <thetext>(In reply to comment #2)
&gt; what about using mktemp?
&gt; 
&gt; i.e. write to /var/tmp/wic-XXX

If /var/tmp itself is owned by someone else that&apos;ll still break.

I&apos;m not sure how to reconcile this with &quot;existing users expect /var/tmp&quot;. We do make backwards-incompatible changes elsewhere from time to time though, if we have to warn people now and then change it in a couple of releases that would be fine. We&apos;d also naturally document it in the migration guide when it does happen.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>70077</commentid>
    <comment_count>4</comment_count>
    <who name="Ed Bartosh">eduard.bartosh</who>
    <bug_when>2017-01-24 14:10:37 +0000</bug_when>
    <thetext>please, review the fix: http://lists.openembedded.org/pipermail/openembedded-core/2017-January/131679.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>70264</commentid>
    <comment_count>5</comment_count>
    <who name="Ed Bartosh">eduard.bartosh</who>
    <bug_when>2017-01-30 19:10:13 +0000</bug_when>
    <thetext>moved to M3. we&apos;re late for M2.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>70320</commentid>
    <comment_count>6</comment_count>
    <who name="Ed Bartosh">eduard.bartosh</who>
    <bug_when>2017-02-01 10:04:38 +0000</bug_when>
    <thetext>The patch has been merged to master.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>70325</commentid>
    <comment_count>7</comment_count>
    <who name="Mikko Ylinen">mikko.ylinen</who>
    <bug_when>2017-02-01 10:38:47 +0000</bug_when>
    <thetext>(In reply to comment #6)
&gt; The patch has been merged to master.

There&apos;s some problem with it:

00:40:53.815 [build_intel-corei7-64] | During handling of the above exception, another exception occurred:
00:40:53.815 [build_intel-corei7-64] | 
00:40:53.815 [build_intel-corei7-64] | Traceback (most recent call last):
00:40:53.815 [build_intel-corei7-64] |   File &quot;/srv/jenkins/workspace/builder-slot-0/openembedded-core/scripts/wic&quot;, line 330, in &lt;module&gt;
00:40:53.815 [build_intel-corei7-64] |     sys.exit(main(sys.argv[1:]))
00:40:53.815 [build_intel-corei7-64] |   File &quot;/srv/jenkins/workspace/builder-slot-0/openembedded-core/scripts/wic&quot;, line 325, in main
00:40:53.815 [build_intel-corei7-64] |     return hlp.invoke_subcommand(args, parser, hlp.wic_help_usage, subcommands)
00:40:53.815 [build_intel-corei7-64] |   File &quot;/srv/jenkins/workspace/builder-slot-0/openembedded-core/scripts/lib/wic/help.py&quot;, line 95, in invoke_subcommand
00:40:53.815 [build_intel-corei7-64] |     subcommands.get(args[0], subcommand_error)[0](args[1:], usage)
00:40:53.815 [build_intel-corei7-64] |   File &quot;/srv/jenkins/workspace/builder-slot-0/openembedded-core/scripts/wic&quot;, line 258, in wic_create_subcommand
00:40:53.815 [build_intel-corei7-64] |     options.compressor, options.bmap, options.debug)
00:40:53.815 [build_intel-corei7-64] |   File &quot;/srv/jenkins/workspace/builder-slot-0/openembedded-core/scripts/lib/wic/engine.py&quot;, line 198, in wic_create
00:40:53.815 [build_intel-corei7-64] |     crobj.main(cmdline)
00:40:53.815 [build_intel-corei7-64] |   File &quot;/srv/jenkins/workspace/builder-slot-0/openembedded-core/scripts/lib/wic/creator.py&quot;, line 125, in main
00:40:53.815 [build_intel-corei7-64] |     return self._subcmds[pname](options, *args[1:])
00:40:53.815 [build_intel-corei7-64] |   File &quot;/srv/jenkins/workspace/builder-slot-0/openembedded-core/scripts/lib/wic/plugins/imager/direct_plugin.py&quot;, line 101, in do_create
00:40:53.815 [build_intel-corei7-64] |     creator.cleanup()
00:40:53.815 [build_intel-corei7-64] |   File &quot;/srv/jenkins/workspace/builder-slot-0/openembedded-core/scripts/lib/wic/imager/direct.py&quot;, line 395, in cleanup
00:40:53.816 [build_intel-corei7-64] |     for fname in os.listdir(self.workdir):
00:40:53.816 [build_intel-corei7-64] | FileNotFoundError: [Errno 2] No such file or directory: &apos;/tmp/wicxbm1fyav&apos;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>70327</commentid>
    <comment_count>8</comment_count>
    <who name="Olev Kartau">olev.kartau</who>
    <bug_when>2017-02-01 12:04:46 +0000</bug_when>
    <thetext>I guess that
tempfile.mktemp(prefix=&apos;wic&apos;)

creates a file, where we actually need directory?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>70328</commentid>
    <comment_count>9</comment_count>
    <who name="Olev Kartau">olev.kartau</who>
    <bug_when>2017-02-01 12:08:58 +0000</bug_when>
    <thetext>I think Mikko copied (2 comments above) a piece which is not most relevant,
the immediate issue reported in build was:

mkdosfs: unable to create /tmp/wicxbm1fyav/rootfs_primary_uefi.1.vfat

and that leads to my guess that tmpdir was not created</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>70359</commentid>
    <comment_count>10</comment_count>
    <who name="Olev Kartau">olev.kartau</who>
    <bug_when>2017-02-02 11:38:23 +0000</bug_when>
    <thetext>correcting my comment, tempfile.mktemp() seems to create nothing.
Even by doc, this function only returns temporary file name,
without creating, and is also deprecated.
mkdtemp should be used to create a directory,
this has fixed issue in local build</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>70364</commentid>
    <comment_count>11</comment_count>
    <who name="Ed Bartosh">eduard.bartosh</who>
    <bug_when>2017-02-02 14:06:17 +0000</bug_when>
    <thetext>Should be fixed by this patchset: http://lists.openembedded.org/pipermail/openembedded-core/2017-February/132189.html

Please, review.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>