Blame SOURCES/0007-ls-in-CSV-mode-always-have-a-checksum-field-RHBZ-115.patch

0d20ef
From 558b40360a293f981bcf8673a97baa8d285c3303 Mon Sep 17 00:00:00 2001
0d20ef
From: Pino Toscano <ptoscano@redhat.com>
0d20ef
Date: Mon, 13 Oct 2014 15:51:34 +0200
0d20ef
Subject: [PATCH] ls: in CSV mode, always have a checksum field (RHBZ#1151900).
0d20ef
0d20ef
Make sure to output the field for checksum even for non-regular files,
0d20ef
as empty, in CSV output mode. This ensures each line has the same number
0d20ef
of fields, regardless of the file type.
0d20ef
0d20ef
(cherry picked from commit e5befcacc5f7c1a6bd67fcdb92afede1a82d50eb)
0d20ef
---
0d20ef
 cat/ls.c | 13 ++++++++-----
0d20ef
 1 file changed, 8 insertions(+), 5 deletions(-)
0d20ef
0d20ef
diff --git a/cat/ls.c b/cat/ls.c
0d20ef
index de8248e..2cb4e74 100644
0d20ef
--- a/cat/ls.c
0d20ef
+++ b/cat/ls.c
0d20ef
@@ -524,12 +524,15 @@ show_file (const char *dir, const char *name,
0d20ef
 
0d20ef
   path = full_path (dir, name);
0d20ef
 
0d20ef
-  if (checksum && is_reg (stat->st_mode)) {
0d20ef
-    csum = guestfs_checksum (g, checksum, path);
0d20ef
-    if (!csum)
0d20ef
-      exit (EXIT_FAILURE);
0d20ef
+  if (checksum) {
0d20ef
+    if (is_reg (stat->st_mode)) {
0d20ef
+      csum = guestfs_checksum (g, checksum, path);
0d20ef
+      if (!csum)
0d20ef
+        exit (EXIT_FAILURE);
0d20ef
 
0d20ef
-    output_string (csum);
0d20ef
+      output_string (csum);
0d20ef
+    } else if (csv)
0d20ef
+      output_string ("");
0d20ef
   }
0d20ef
 
0d20ef
   output_string (path);
0d20ef
-- 
0d20ef
1.8.3.1
0d20ef