All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Eggleton <paul.eggleton@linux.intel.com>
To: poky@yoctoproject.org
Subject: Re: [PATCH 3/3] sanity.bbclass: add check for creation of long filenames
Date: Fri, 17 Dec 2010 10:31:27 +0000	[thread overview]
Message-ID: <201012171031.27613.paul.eggleton@linux.intel.com> (raw)
In-Reply-To: <e6ddab5faef1cbb1d47d2eb873c7123bee09e6d5.1292523172.git.paul.eggleton@linux.intel.com>

[-- Attachment #1: Type: Text/Plain, Size: 204 bytes --]

It seems that in my haste yesterday I neglected to commit some changes before posting the 3rd patch. Correct patch is attached (and contrib branch paule/sanity-checks has been updated).

Cheers,
Paul

[-- Attachment #2: sanity-filename-length.patch --]
[-- Type: text/x-patch, Size: 3449 bytes --]

commit c028532cdf98f310cb043fa3770a2f5b9b4a10bb
Author: Paul Eggleton <paul.eggleton@linux.intel.com>
Date:   Thu Dec 16 17:35:31 2010 +0000

    sanity.bbclass: add check for creation of long filenames
    
    Detect and fail if filesystem in use for TMPDIR or SSTATE_DIR has an
    unreasonably short file name length limit (eg. eCryptFS). This can cause
    "file name too long" errors during poky builds (e.g. when writing sstate
    files for packages with a git revision as the version).
    
    Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>

diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
index 969cc2e..9d183e3 100644
--- a/meta/classes/sanity.bbclass
+++ b/meta/classes/sanity.bbclass
@@ -21,18 +21,41 @@ def check_conf_exists(fn, data):
             return True
     return False
 
-def check_sanity_sstate_dir_change():
+def check_sanity_sstate_dir_change(sstate_dir):
     # Sanity checks to be done when the value of SSTATE_DIR changes
-    return ""
 
-def check_sanity_tmpdir_change():
+    # Check that SSTATE_DIR isn't on a filesystem with limited filename length (eg. eCryptFS)
+    testmsg = ""
+    if sstate_dir != "":
+        testmsg = check_create_long_filename(sstate_dir, "SSTATE_DIR")
+    return testmsg
+
+def check_sanity_tmpdir_change(tmpdir):
     # Sanity checks to be done when the value of TMPDIR changes
-    return ""
+
+    # Check that TMPDIR isn't on a filesystem with limited filename length (eg. eCryptFS)
+    testmsg = check_create_long_filename(tmpdir, "TMPDIR")
+    return testmsg
         
 def check_sanity_version_change():
     # Sanity checks to be done when SANITY_VERSION changes
     return ""
     
+def check_create_long_filename(filepath, pathname):
+    testfile = os.path.join(filepath, ''.join([`num`[-1] for num in xrange(1,200)]))
+    try:
+        if not os.path.exists(filepath):
+            bb.utils.mkdirhier(filepath)
+        f = file(testfile, "w")
+        f.close()
+        os.remove(testfile)
+    except IOError as (errno, strerror):
+        if errno == 36: # ENAMETOOLONG
+            return "Failed to create a file with a long name in %s. Please use a filesystem that does not unreasonably limit filename length.\n" % pathname
+        else:
+            return "Failed to create a file in %s: %s" % (pathname, strerror)
+    return ""
+
 def check_sanity(e):
     from bb import note, error, data, __version__
 
@@ -206,13 +229,13 @@ def check_sanity(e):
     sanity_version = int(data.getVar('SANITY_VERSION', e.data, True) or 1)
     if last_sanity_version < sanity_version: 
         messages = messages + check_sanity_version_change()
-        messages = messages + check_sanity_tmpdir_change()
-        messages = messages + check_sanity_sstate_dir_change()
+        messages = messages + check_sanity_tmpdir_change(tmpdir)
+        messages = messages + check_sanity_sstate_dir_change(sstate_dir)
     else: 
         if last_tmpdir != tmpdir:
-            messages = messages + check_sanity_tmpdir_change()
+            messages = messages + check_sanity_tmpdir_change(tmpdir)
         if last_sstate_dir != sstate_dir:
-            messages = messages + check_sanity_sstate_dir_change()
+            messages = messages + check_sanity_sstate_dir_change(sstate_dir)
 
     if os.path.exists("conf"):
         f = file(sanityverfile, 'w')

  reply	other threads:[~2010-12-17 10:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-16 18:12 [PATCH 0/3] sanity checking improvements Paul Eggleton
2010-12-16 11:10 ` [PATCH 1/3] sanity.bbclass: make indenting consistent Paul Eggleton
2010-12-16 16:25 ` [PATCH 2/3] sanity.bbclass: allow minimisation of impact of more invasive sanity checks Paul Eggleton
2010-12-16 17:35 ` [PATCH 3/3] sanity.bbclass: add check for creation of long filenames Paul Eggleton
2010-12-17 10:31   ` Paul Eggleton [this message]
2010-12-20 14:54 ` [PATCH 0/3] sanity checking improvements Richard Purdie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201012171031.27613.paul.eggleton@linux.intel.com \
    --to=paul.eggleton@linux.intel.com \
    --cc=poky@yoctoproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.