On Mon, 3 Aug 2015 17:30:49 +0200 =?iso-8859-1?B?Suly6W15?= Bobbio
<lu...@debian.org> wrote:
> Tiny nitpick: the option might now have the best name. `unsquashfs`
> currently supports `-l` = `-ls` and `-ll` = `-lls`. I guess the latter
> is far 'long ls'. Puting the 'n' in the middle of 'ls' seems a bit
> confusing.

fixed in the attached patch

> Maybe the call to getpwuid() could be avoided entirely if numeric_ls is
> set? With the above this will look up the NSS database, and then ditch
> the result. This makes unecessary computations.

thanks also fixed

                          `-
diff -Nru squashfs-tools-4.2+20130409/debian/changelog 
squashfs-tools-4.2+20130409/debian/changelog
--- squashfs-tools-4.2+20130409/debian/changelog        2013-09-18 
10:22:27.000000000 +0200
+++ squashfs-tools-4.2+20130409/debian/changelog        2015-08-03 
16:15:27.000000000 +0200
@@ -1,3 +1,10 @@
+squashfs-tools (1:4.2+20130409-2.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Adding lns option to unsquashfs
+
+ -- akira <marival...@gmail.com>  Mon, 03 Aug 2015 16:12:14 +0200
+
 squashfs-tools (1:4.2+20130409-2) unstable; urgency=low
 
   * New maintainer (closes: #723600).
diff -Nru squashfs-tools-4.2+20130409/debian/manpages/unsquashfs.1 
squashfs-tools-4.2+20130409/debian/manpages/unsquashfs.1
--- squashfs-tools-4.2+20130409/debian/manpages/unsquashfs.1    2013-05-09 
22:22:49.000000000 +0200
+++ squashfs-tools-4.2+20130409/debian/manpages/unsquashfs.1    2015-08-03 
18:01:33.000000000 +0200
@@ -32,6 +32,8 @@
 list filesystem, but don't unsquash.
 .IP "\-ll, \-lls" 4
 list filesystem with file attributes (like ls \-l output), but don't unsquash.
+.IP "\-nl, \-nls" 4
+list filesystem with file attributes (like ls \-n output), but don't unsquash.
 .IP "\-f, \-force" 4
 if file already exists then overwrite.
 .IP "\-s, \-stat" 4
diff -Nru squashfs-tools-4.2+20130409/debian/patches/nousername 
squashfs-tools-4.2+20130409/debian/patches/nousername
--- squashfs-tools-4.2+20130409/debian/patches/nousername       1970-01-01 
01:00:00.000000000 +0100
+++ squashfs-tools-4.2+20130409/debian/patches/nousername       2015-08-03 
18:01:40.000000000 +0200
@@ -0,0 +1,68 @@
+--- a/unsquashfs.c
++++ b/unsquashfs.c
+@@ -62,7 +62,7 @@ char *file_data;
+ char *data;
+ unsigned int block_size;
+ unsigned int block_log;
+-int lsonly = FALSE, info = FALSE, force = FALSE, short_ls = TRUE;
++int lsonly = FALSE, info = FALSE, force = FALSE, short_ls = TRUE, numeric_ls 
= FALSE;
+ int use_regex = FALSE;
+ char **created_inode;
+ int root_process;
+@@ -482,8 +482,8 @@ int print_filename(char *pathname, struc
+       char str[11], dummy[12], dummy2[12]; /* overflow safe */
+       char *userstr, *groupstr;
+       int padchars;
+-      struct passwd *user;
+-      struct group *group;
++      struct passwd *user = NULL;
++      struct group *group = NULL;
+       struct tm *t;
+ 
+       if(short_ls) {
+@@ -491,8 +491,9 @@ int print_filename(char *pathname, struc
+               return 1;
+       }
+ 
+-      user = getpwuid(inode->uid);
+-      if(user == NULL) {
++      if(!numeric_ls)
++              user = getpwuid(inode->uid);
++      if(user == NULL || numeric_ls) {
+               int res = snprintf(dummy, 12, "%d", inode->uid);
+               if(res < 0)
+                       EXIT_UNSQUASH("snprintf failed in print_filename()\n");
+@@ -505,8 +506,9 @@ int print_filename(char *pathname, struc
+       } else
+               userstr = user->pw_name;
+                
+-      group = getgrgid(inode->gid);
+-      if(group == NULL) {
++      if(!numeric_ls)
++              group = getgrgid(inode->gid);
++      if(group == NULL || numeric_ls) {
+               int res = snprintf(dummy2, 12, "%d", inode->gid);
+               if(res < 0)
+                       EXIT_UNSQUASH("snprintf failed in print_filename()\n");
+@@ -2512,6 +2514,11 @@ int main(int argc, char *argv[])
+                               strcmp(argv[i], "-ll") == 0) {
+                       lsonly = TRUE;
+                       short_ls = FALSE;
++              } else if(strcmp(argv[i], "-nls") == 0 ||
++                              strcmp(argv[i], "-nl") == 0) {
++                      lsonly = TRUE;
++                      short_ls = FALSE;
++                      numeric_ls = TRUE;
+               } else if(strcmp(argv[i], "-linfo") == 0 ||
+                               strcmp(argv[i], "-li") == 0) {
+                       info = TRUE;
+@@ -2569,6 +2576,9 @@ options:
+                       ERROR("\t-ll[s]\t\t\tlist filesystem with file "
+                               "attributes (like\n");
+                       ERROR("\t\t\t\tls -l output), but don't unsquash\n");
++                      ERROR("\t-nl[s]\t\t\tlist filesystem with file "
++                              "attributes (like\n");
++                      ERROR("\t\t\t\tls -n output), but don't unsquash\n");
+                       ERROR("\t-f[orce]\t\tif file already exists then "
+                               "overwrite\n");
+                       ERROR("\t-s[tat]\t\t\tdisplay filesystem superblock "
diff -Nru squashfs-tools-4.2+20130409/debian/patches/series 
squashfs-tools-4.2+20130409/debian/patches/series
--- squashfs-tools-4.2+20130409/debian/patches/series   2013-05-09 
22:22:49.000000000 +0200
+++ squashfs-tools-4.2+20130409/debian/patches/series   2015-08-03 
16:30:54.000000000 +0200
@@ -1 +1,2 @@
 0001-kfreebsd.patch
+nousername

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to