Skip to contentSkip to conversation

sanity.bbclass: Barf if TMPDIR has trailing forward slash

PATCH In review Khem Raj 3 participants 7 messages May 26, 2010

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/1 sanity.bbclass: Barf if TMPDIR has trailing forward slash

* Unknowingly many developers run into this issue and
painful part it that the problems start happening almost
when build it complete and the errors are unrelated to cause
see http://www.mail-archive.com/[email protected]/msg02922.html

---
 classes/sanity.bbclass |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
classes/sanity.bbclass +9 -2
index dfb3010..88672ba 100644
@@ -112,11 +112,18 @@ def check_sanity(e):
 	oes_bb_conf = data.getVar( 'OES_BITBAKE_CONF', e.data, True )
 	if not oes_bb_conf:
 		messages = messages + 'You do not include OpenEmbeddeds version of conf/bitbake.conf. This means your environment is misconfigured, in particular check BBPATH.\n'
-
 	#
-	# Check that TMPDIR hasn't changed location since the last time we were run
+	# get TMPDIR and use it in following two checks
 	#
 	tmpdir = data.getVar('TMPDIR', e.data, True)
+	#
+	# check if tmpdir has traling '/'
+	#
+	if tmpdir[-1] == "/":
+		messages = messages + "Your TMPDIR has trailing '/' (forward slash), this can cause autotools lamangler fail regexp matches when munging .la files. Please remove it.\n\t"
+	#
+	# Check that TMPDIR hasn't changed location since the last time we were run
+	#
 	checkfile = os.path.join(tmpdir, "saved_tmpdir")
 	if os.path.exists(checkfile):
 		f = file(checkfile, "r")
Signature · 1 line
1.7.0.4
Acked-by on v1 1/1
#1 lore raw

2010/5/26 Khem Raj <[email protected]>:

Quoted 29 lines

* Unknowingly many developers run into this issue and
 painful part it that the problems start happening almost
 when build it complete and the errors are unrelated to cause
 see http://www.mail-archive.com/[email protected]/msg02922.html

---
 classes/sanity.bbclass |   11 +++++++++--

 1 files changed, 9 insertions(+), 2 deletions(-)
classes/sanity.bbclass +0 -0
index dfb3010..88672ba 100644
@@ -112,11 +112,18 @@ def check_sanity(e):
        oes_bb_conf = data.getVar( 'OES_BITBAKE_CONF', e.data, True )

       if not oes_bb_conf:
               messages = messages + 'You do not include OpenEmbeddeds version of conf/bitbake.conf. This means your environment is misconfigured, in particular check BBPATH.\n' -
       #
-       # Check that TMPDIR hasn't changed location since the last time we were run
+       # get TMPDIR and use it in following two checks
       #
       tmpdir = data.getVar('TMPDIR', e.data, True)
+       #
+       # check if tmpdir has traling '/'
+       #
+       if tmpdir[-1] == "/":
+               messages = messages + "Your TMPDIR has trailing '/' (forward slash), this can cause autotools lamangler fail regexp matches when munging .la files. Please remove it.\n\t"

Quoted 9 lines

+       #
+       # Check that TMPDIR hasn't changed location since the last time we were run
+       #
       checkfile = os.path.join(tmpdir, "saved_tmpdir")
       if os.path.exists(checkfile):
               f = file(checkfile, "r")
--
1.7.0.4

Tested. works great for me so:

#2 lore raw
In reply to Khem Raj
Quoted 4 lines · Khem Raj

* Unknowingly many developers run into this issue and
painful part it that the problems start happening almost
when build it complete and the errors are unrelated to cause
see http://www.mail-archive.com/[email protected]/msg02922.html

Can we not fix the actual bug rather than disallowing trailing slashes? It seems a bit sad to introduce further weird limitations just to work around some or other piece of brokenness.

p.

author
#3 lore raw
Quoted 9 lines · Phil Blundell
Quoted 4 lines · Khem Raj

* Unknowingly many developers run into this issue and
  painful part it that the problems start happening almost
  when build it complete and the errors are unrelated to cause
  see http://www.mail-archive.com/[email protected]/msg02922.html

Can we not fix the actual bug rather than disallowing trailing slashes? It seems a bit sad to introduce further weird limitations just to work around some or other piece of brokenness.

Yes I thought about it but did not know where to start.
I guess that would be bitbake which has to quickly remove the trailing space just after parsing
in TMPDIR before it gets expanded into other parts of metadata. would it be OK for bitbake to treat TMPDIR special ? or may be bitbake should just get rid of more than one slashes in dir paths as a whole. when concatenating two paths it should merge the slashes may be.

Quoted 10 lines

p.

_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel

#4 lore raw
Quoted 7 lines · Khem Raj

Yes I thought about it but did not know where to start.
I guess that would be bitbake which has to quickly remove the trailing space just after parsing
in TMPDIR before it gets expanded into other parts of metadata. would it be OK for bitbake to treat TMPDIR special ? or may be bitbake should just get rid of more than one slashes in dir paths as a whole. when concatenating two paths it should merge the slashes may be.

I'm not sure that bitbake itself ought to be taking any special action. Which piece of code is it that chokes on the extra slashes, exactly? Can that not be fixed? POSIX is fairly clear that multiple slashes are allowed in pathnames so anything that doesn't work with them seems like it must be broken.

p.

author
#5 lore raw
Quoted 9 lines · Phil Blundell
Quoted 7 lines · Khem Raj

Yes I thought about it but did not know where to start.
I guess that would be bitbake which has to quickly remove the trailing space just after parsing
in TMPDIR before it gets expanded into other parts of metadata. would it be OK for bitbake to treat TMPDIR special ? or may be bitbake should just get rid of more than one slashes in dir paths as a whole. when concatenating two paths it should merge the slashes may be.

Quoted 5 lines

I'm not sure that bitbake itself ought to be taking any special action. Which piece of code is it that chokes on the extra slashes, exactly? Can that not be fixed?  POSIX is fairly clear that multiple slashes are allowed in pathnames so anything that doesn't work with them seems like it must be broken.

autotools_prepackage_lamangler () in classes/autotools.bbclass.
see http://www.mail-archive.com/[email protected]/msg02922.html
for more details. Thats one known case so far.

Thx
-Khem

#6 lore raw
In reply to Phil Blundell

I agree that fixing this is better than a warning, but a warning is better than nothing, so I suggest at least taking this patch. No idea how to fix it structurally.
A workaround (read; dirty patch) would be to nuke off trailing slashes when TMPDIR is retrieved.

BTW: the problem seems to be around quite a while and regularly seems to bite people.

Frans