<?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>12374</bug_id>
          
          <creation_ts>2017-11-22 07:31:38 +0000</creation_ts>
          <short_desc>do_rootfs failed when len(TMPDIR) == 410</short_desc>
          <delta_ts>2023-01-16 15:09:09 +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>2.5</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>normal</bug_severity>
          <target_milestone>4.2 M3</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Robert Yang">liezhi.yang</reporter>
          <assigned_to name="Yoann Congal">yoann.congal</assigned_to>
          <cc>chee.yang.lee</cc>
    
    <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>yoann.congal</cc>
          
          
          <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>78314</commentid>
    <comment_count>0</comment_count>
    <who name="Robert Yang">liezhi.yang</who>
    <bug_when>2017-11-22 07:31:38 +0000</bug_when>
    <thetext>when len(TMPDIR) == 410 and run bitbake core-image-minimal

  File &quot;/workspace2/lyang1/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaa/tmp/work/qemux86-poky-linux/core-image-minimal/1.0-r0/recipe-sysroot-native/usr/lib/python3.5/site-packages/dnf/base.py&quot;, line 782, in _run_transaction
    lastdbv = self.history.last()
  File &quot;/workspace2/lyang1/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaa/tmp/work/qemux86-poky-linux/core-image-minimal/1.0-r0/recipe-sysroot-native/usr/lib/python3.5/site-packages/dnf/base.py&quot;, line 526, in &lt;lambda&gt;
    history = property(fget=lambda self: self._getHistory(),
  File &quot;/workspace2/lyang1/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaa/tmp/work/qemux86-poky-linux/core-image-minimal/1.0-r0/recipe-sysroot-native/usr/lib/python3.5/site-packages/dnf/base.py&quot;, line 523, in _getHistory
    releasever=releasever)
  File &quot;/workspace2/lyang1/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaa/tmp/work/qemux86-poky-linux/core-image-minimal/1.0-r0/recipe-sysroot-native/usr/lib/python3.5/site-packages/dnf/yum/history.py&quot;, line 775, in __init__
    self._create_db_file()
  File &quot;/workspace2/lyang1/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaa/tmp/work/qemux86-poky-linux/core-image-minimal/1.0-r0/recipe-sysroot-native/usr/lib/python3.5/site-packages/dnf/yum/history.py&quot;, line 1710, in _create_db_file
    cur = self._get_cursor()
  File &quot;/workspace2/lyang1/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaaaa/aaaaaaaaa/aaaaaa/tmp/work/qemux86-poky-linux/core-image-minimal/1.0-r0/recipe-sysroot-native/usr/lib/python3.5/site-packages/dnf/yum/history.py&quot;, line 799, in _get_cursor
    self._conn = sqlite.connect(self._db_file)
sqlite3.OperationalError: unable to open database file</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94036</commentid>
    <comment_count>1</comment_count>
    <who name="Chee Yang">chee.yang.lee</who>
    <bug_when>2022-09-20 05:53:16 +0000</bug_when>
    <thetext>related bug at createrepo_c 
https://github.com/rpm-software-management/createrepo_c/issues/220</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94642</commentid>
    <comment_count>2</comment_count>
    <who name="Yoann Congal">yoann.congal</who>
    <bug_when>2023-01-08 09:10:47 +0000</bug_when>
    <thetext>I&apos;ve looked into this and it really looks like a hard limit on path length in the sqlite code. I guess we can do 2 things about this :
- Setup an explicit error when this path length is used (saying we don&apos;t support this, sadly)
- Trying to push an improvement to sqlite to remove this limitation</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94649</commentid>
    <comment_count>3</comment_count>
    <who name="Yoann Congal">yoann.congal</who>
    <bug_when>2023-01-10 09:54:17 +0000</bug_when>
    <thetext>https://github.dev/sqlite/sqlite/blob/master/src/os_unix.c#L179-L180 :
#define MAX_PATHNAME 512

This looks quite low...

I can reproduce this limitation with the &quot;sqlite3&quot; CLI tool :
 T=&quot;aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/&quot;
 # T is 480 char long
 sqlite3 t.db &apos;create table tbl(x int);&apos; # create t.db
 mkdir -p &quot;$T&quot; # create long named directory

 sqlite3 t.db .dump # Opens OK
 cp t.db $T/
 sqlite3 $T/t.db .dump # fails to open
 Error: unable to open database &quot;aaaaaaaaa/[..snip]/aaaaaaaaa//t.db&quot;: unable to open database file

=&gt; This confirms this bug is a limitation of sqlite</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94651</commentid>
    <comment_count>4</comment_count>
    <who name="Yoann Congal">yoann.congal</who>
    <bug_when>2023-01-10 17:02:03 +0000</bug_when>
    <thetext>Some elements discussed during the &quot;Yocto Project Technical Team Meeting / Engineering Sync&quot;:
* SQlite ticket about this limit closed as &quot;Won&apos;t fix&quot; : https://sqlite.org/cgi/src/tktview/c060923a5422590b3734
* meta/classes-global/sanity.bbclass contains a Sanity test:
  * status.addresult(check_path_length(tmpdir, &quot;TMPDIR&quot;, 410))
* My guess is that bitbake tries to open a sqlite database *before* reaching the sanity.bbclass tests (Will check)
* Maybe a trick where we exchange path length between CWD and &quot;relative path&quot; ? (Did not find it at first, will try further)
* We may need to put this check in bitbake itself</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94655</commentid>
    <comment_count>5</comment_count>
    <who name="Yoann Congal">yoann.congal</who>
    <bug_when>2023-01-10 22:14:28 +0000</bug_when>
    <thetext>&gt; Some elements discussed during the &quot;Yocto Project Technical Team Meeting /
&gt; Engineering Sync&quot;:
&gt; * meta/classes-global/sanity.bbclass contains a Sanity test:
&gt;   * status.addresult(check_path_length(tmpdir, &quot;TMPDIR&quot;, 410))
&gt; * My guess is that bitbake tries to open a sqlite database *before* reaching
&gt; the sanity.bbclass tests (Will check)

Confirmed, bitbake does connect to the sqlite database before the sanity.bbclass checks.
Note: those checks are not made every time (remove cache/sanity_info to force this sanity check)

 $ rm cache/sanity_info ; bitbake -p
NOTE: Connecting to self.cachefile=&apos;.../cache/bb_persist_data.sqlite3&apos; (len(self.cachefile)=109)
# bitbake/lib/bb/persist_data.py:103
NOTE: Checking path length of TMPDIR : tmpdir=&apos;.../tmp&apos; len(tmpdir)=83 vs 410
# =&gt; sanity.bbclass:735
Loading cache: 100% |##########################################################################################################################################################| Time: 0:00:00
Loaded 2897 entries from dependency cache.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94656</commentid>
    <comment_count>6</comment_count>
    <who name="Yoann Congal">yoann.congal</who>
    <bug_when>2023-01-10 22:42:50 +0000</bug_when>
    <thetext>Backtrace of the call that happens before the sanity check :
NOTE: bb.persist_data.persist called here : .../poky/bitbake/lib/bb/fetch2/__init__.py:501 (fetcher_init)
NOTE: backtrace = 
NOTE:     File &quot;.../poky/bitbake/bin/bitbake-server&quot;, line 54, in &lt;module&gt;
    bb.server.process.execServer(lockfd, readypipeinfd, lockname, sockname, timeout, xmlrpcinterface, profile)

NOTE:     File &quot;.../poky/bitbake/lib/bb/server/process.py&quot;, line 636, in execServer
    server.run()

NOTE:     File &quot;.../poky/bitbake/lib/bb/server/process.py&quot;, line 153, in run
    ret = self.main()

NOTE:     File &quot;.../poky/bitbake/lib/bb/server/process.py&quot;, line 274, in main
    self.command_channel_reply.send(self.cooker.command.runCommand(command, self))

NOTE:     File &quot;.../poky/bitbake/lib/bb/command.py&quot;, line 90, in runCommand
    result = command_method(self, commandline)

NOTE:     File &quot;.../poky/bitbake/lib/bb/command.py&quot;, line 292, in updateConfig
    command.cooker.updateConfigOpts(options, environment, cmdline)

NOTE:     File &quot;.../poky/bitbake/lib/bb/cooker.py&quot;, line 536, in updateConfigOpts
    self.reset()

NOTE:     File &quot;.../poky/bitbake/lib/bb/cooker.py&quot;, line 1783, in reset
    self.initConfigurationData()

NOTE:     File &quot;.../poky/bitbake/lib/bb/cooker.py&quot;, line 393, in initConfigurationData
    self.databuilder.parseBaseConfiguration()

NOTE:     File &quot;.../poky/bitbake/lib/bb/cookerdata.py&quot;, line 272, in parseBaseConfiguration
    bb.fetch.fetcher_init(self.data)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94657</commentid>
    <comment_count>7</comment_count>
    <who name="Yoann Congal">yoann.congal</who>
    <bug_when>2023-01-10 23:39:08 +0000</bug_when>
    <thetext>sqlite (either CLI tool or sqlite3.connect()) fails for absolute path &gt;=505 chars.
persist_data.py opens &quot;${TOPDIR}/cache/bb_persist_data.sqlite3&quot;.
len(&quot;/cache/bb_persist_data.sqlite3&quot;) = 30
=&gt; this does limit $TOPDIR to 474 chars (which is above the sanity check at ~410 btw)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94673</commentid>
    <comment_count>8</comment_count>
    <who name="Yoann Congal">yoann.congal</who>
    <bug_when>2023-01-11 22:46:37 +0000</bug_when>
    <thetext>I&apos;ve sent a patch [1] handling the error thrown by sqlite to display clear error message instead of the stacktrace...

[1]: https://lore.kernel.org/bitbake-devel/20230111223729.3472181-1-yoann.congal@smile.fr/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94712</commentid>
    <comment_count>9</comment_count>
    <who name="Yoann Congal">yoann.congal</who>
    <bug_when>2023-01-12 19:39:31 +0000</bug_when>
    <thetext>V2 here (changed python string formating method) :
https://lore.kernel.org/bitbake-devel/20230112193255.38994-1-yoann.congal@smile.fr/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94732</commentid>
    <comment_count>10</comment_count>
    <who name="Yoann Congal">yoann.congal</who>
    <bug_when>2023-01-16 15:09:09 +0000</bug_when>
    <thetext>Fixed by https://git.yoctoproject.org/poky/commit/?id=e1a661e3d2d4d62aa0c47c2abb0a6824e1b17ede

=&gt; Print a nice error message instead of a backtrace

FYI : The new SQlite post about this limit is here https://sqlite.org/forum/forumpost/0b1b8b5116 (no answer as of now)</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>