]> sourceware.org Git - debugedit.git/commitdiff
debugedit: Distinguish files from directories in src list file
authorVitaly Chikunov <vt@altlinux.org>
Sat, 14 Nov 2020 19:32:44 +0000 (22:32 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Tue, 16 Feb 2021 07:10:18 +0000 (09:10 +0200)
Append '/' to directories in source file list (for `-l' option) to allow
quickly distinguish them from regular files (to avoid adding them raw
into %files section). This is needed for ALT for our debuginfo
processing to speed things up.

Co-authored-by: Dmitry V. Levin <ldv@altlinux.org>
tools/debugedit.c

index e9d8f3ae74744d50ac542570eabd8576e315d46e..bbc06040850b17fd46832b273f830af348b643b3 100644 (file)
@@ -1923,7 +1923,7 @@ edit_attributes (DSO *dso, unsigned char *ptr, struct abbrev_tag *t, int phase)
       const char *p = skip_dir_prefix (comp_dir, base_dir);
       if (p != NULL && p[0] != '\0')
         {
-         size_t size = strlen (p) + 1;
+         size_t size = strlen (p);
          while (size > 0)
            {
              ssize_t ret = write (list_file_fd, p, size);
@@ -1932,6 +1932,15 @@ edit_attributes (DSO *dso, unsigned char *ptr, struct abbrev_tag *t, int phase)
              size -= ret;
              p += ret;
            }
+         /* Output trailing dir separator to distinguish them quickly from
+            regular files. */
+         if (size == 0)
+           {
+             if (*(p - 1) != '/')
+               write (list_file_fd, "/", 2);
+             else
+               write (list_file_fd, "", 1);
+           }
        }
     }
 
This page took 0.030749 seconds and 5 git commands to generate.