Skip to contentSkip to conversation

pax : strip off the trailing slash of file name

PATCH In review [email protected] 2 participants 2 messages Nov 1, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pax : strip off the trailing slash of file name

From: Zhang Xiao <[email protected]>

When extracting packaes, the trailing slash of the file name has no means but may cause some issue on system call lstat. Remove it.

---
 .../pax-strip-off-file-name-s-trailing-slash.patch | 48 ++++++++++++++++++++++
 meta/recipes-extended/pax/pax_3.4.bb               |  4 +-
 2 files changed, 51 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-extended/pax/pax/pax-strip-off-file-name-s-trailing-slash.patch
meta/recipes-extended/pax/pax/pax-strip-off-file-name-s-trailing-slash.patch new file +48 -0
new file mode 100644
index 0000000..9e0a335
@@ -0,0 +1,48 @@
+From aa8ba118869b75a2a9cd681b2f0362d9d8f1c7ec Mon Sep 17 00:00:00 2001
+From: Zhang Xiao <[email protected]>
+Date: Tue, 12 Jul 2016 11:34:45 +0800
+Subject: [PATCH] pax: strip off the trailing slash of file name
+
+When extracting packaes, the trailing slash of the file name
+has no means but may cause some issue on system call lstat.
+Remove it.
+
+Upstream-Status: Pending
+
+Signed-off-by: Zhang Xiao <[email protected]>
+---
+ src/pat_rep.c | 11 ++++++++++-
+ 1 file changed, 10 insertions(+), 1 deletion(-)
+
+diff --git a/src/pat_rep.c b/src/pat_rep.c
+index b9a4636..4cbf6bf 100644
+--- a/src/pat_rep.c
++++ b/src/pat_rep.c
+@@ -605,7 +605,7 @@ int
+ mod_name(ARCHD *arcn)
+ {
+ 	int res = 0;
+-
++	char *pt;
+ 	/*
+ 	 * Strip off leading '/' if appropriate.
+ 	 * Currently, this option is only set for the tar format.
+@@ -639,6 +639,15 @@ mod_name(ARCHD *arcn)
+ 	}
+ 
+ 	/*
++	 * strip off trailing slash.
++	 */
++	pt = &(arcn->name[strlen(arcn->name) - 1]);
++	if (*pt == '/') {
++		 *pt = '\0';
++		arcn->nlen = strlen(arcn->name);
++	}
++
++	/*
+ 	 * IMPORTANT: We have a problem. what do we do with symlinks?
+ 	 * Modifying a hard link name makes sense, as we know the file it
+ 	 * points at should have been seen already in the archive (and if it
+-- 
+1.8.5.2.233.g932f7e4
+
meta/recipes-extended/pax/pax_3.4.bb +3 -1
index 9d1abfb..7ce43ce 100644
@@ -16,7 +16,9 @@ DEPENDS_append_libc-musl = " fts "
 
 SRC_URI = "http://pkgs.fedoraproject.org/repo/pkgs/${BPN}/${BP}.tar.bz2/fbd9023b590b45ac3ade95870702a0d6/${BP}.tar.bz2 \
 	file://fix_for_compile_with_gcc-4.6.0.patch \
-	file://pax-3.4_fix_for_x32.patch"
+	file://pax-3.4_fix_for_x32.patch \
+	file://pax-strip-off-file-name-s-trailing-slash.patch \
+"
 
 SRC_URI_append_libc-musl = " file://0001-Fix-build-with-musl.patch \
                              file://0001-use-strtoll-instead-of-strtoq.patch \
Signature · 1 line
2.8.3
#1 lore raw

This should be submitted upstream for further review. I believe this could be covered by a cmdline option

Quoted 101 lines · On Oct 31, 2016 8:11 PM, <[email protected]> wrote:

From: Zhang Xiao <[email protected]>

When extracting packaes, the trailing slash of the file name has no means but may cause some issue on system call lstat. Remove it.

---
 .../pax-strip-off-file-name-s-trailing-slash.patch | 48
++++++++++++++++++++++
 meta/recipes-extended/pax/pax_3.4.bb               |  4 +-
 2 files changed, 51 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-extended/pax/pax/

pax-strip-off-file-name-s-trailing-slash.patch

meta/recipes-extended/pax/pax/pax-strip-off-file-name-s- renamed from meta/recipes-extended/pax/pax/pax-strip-off-file-name-s-trailing-slash.patch +0 -0

trailing-slash.patch
new file mode 100644
index 0000000..9e0a335

meta/recipes-extended/pax/pax/pax-strip-off-file-name-s- new file +0 -0

trailing-slash.patch

meta/recipes-extended/pax/pax/pax-strip-off-file-name-s- new file +45 -0
@@ -0,0 +1,48 @@
+From aa8ba118869b75a2a9cd681b2f0362d9d8f1c7ec Mon Sep 17 00:00:00 2001
+From: Zhang Xiao <[email protected]>
+Date: Tue, 12 Jul 2016 11:34:45 +0800
+Subject: [PATCH] pax: strip off the trailing slash of file name
+
+When extracting packaes, the trailing slash of the file name
+has no means but may cause some issue on system call lstat.
+Remove it.
+
+Upstream-Status: Pending
+
+Signed-off-by: Zhang Xiao <[email protected]>
+---
+ src/pat_rep.c | 11 ++++++++++-
+ 1 file changed, 10 insertions(+), 1 deletion(-)
+
+diff --git a/src/pat_rep.c b/src/pat_rep.c
+index b9a4636..4cbf6bf 100644
+--- a/src/pat_rep.c
++++ b/src/pat_rep.c
+@@ -605,7 +605,7 @@ int
+ mod_name(ARCHD *arcn)
+ {
+       int res = 0;
+-
++      char *pt;
+       /*
+        * Strip off leading '/' if appropriate.
+        * Currently, this option is only set for the tar format.
+@@ -639,6 +639,15 @@ mod_name(ARCHD *arcn)
+       }
+
+       /*
++       * strip off trailing slash.
++       */
++      pt = &(arcn->name[strlen(arcn->name) - 1]);
++      if (*pt == '/') {
++               *pt = '\0';
++              arcn->nlen = strlen(arcn->name);
++      }
++
++      /*
+        * IMPORTANT: We have a problem. what do we do with symlinks?
+        * Modifying a hard link name makes sense, as we know the file it
+        * points at should have been seen already in the archive (and if

it
+--
+1.8.5.2.233.g932f7e4

meta/recipes-extended/pax/pax/pax-strip-off-file-name-s- new file +1 -0
+
meta/recipes-extended/pax/pax_3.4.bb +3 -1
index 9d1abfb..7ce43ce 100644
@@ -16,7 +16,9 @@ DEPENDS_append_libc-musl = " fts "
 
 SRC_URI = "http://pkgs.fedoraproject.org/repo/pkgs/${BPN}/${BP}.tar.bz2/
 fbd9023b590b45ac3ade95870702a0d6/${BP}.tar.bz2 \
        file://fix_for_compile_with_gcc-4.6.0.patch \
-       file://pax-3.4_fix_for_x32.patch"
+       file://pax-3.4_fix_for_x32.patch \
+       file://pax-strip-off-file-name-s-trailing-slash.patch \
+"
 
 SRC_URI_append_libc-musl = " file://0001-Fix-build-with-musl.patch \
                              file://0001-use-strtoll-instead-of-strtoq.patch

\
--
2.8.3

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core