Hello community,

here is the log from the commit of package sg3_utils for openSUSE:Factory 
checked in at 2014-04-26 17:01:48
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/sg3_utils (Old)
 and      /work/SRC/openSUSE:Factory/.sg3_utils.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "sg3_utils"

Changes:
--------
--- /work/SRC/openSUSE:Factory/sg3_utils/sg3_utils.changes      2014-04-14 
06:42:20.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.sg3_utils.new/sg3_utils.changes 2014-04-26 
17:01:50.000000000 +0200
@@ -1,0 +2,9 @@
+Tue Apr 15 20:11:54 UTC 2014 - spargaon...@suse.com
+
+- added patch sginfo-inq-fields-strip-blank.patch 
+  sg3_utils: Strip out trailing info from vendor info products fields in inq
+  bnc#863357
+
+- added patches:
+  * sginfo-inq-fields-strip-blank.patch
+-------------------------------------------------------------------

New:
----
  sginfo-inq-fields-strip-blank.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ sg3_utils.spec ++++++
--- /var/tmp/diff_new_pack.lFEhBp/_old  2014-04-26 17:01:51.000000000 +0200
+++ /var/tmp/diff_new_pack.lFEhBp/_new  2014-04-26 17:01:51.000000000 +0200
@@ -27,6 +27,7 @@
 
 Source:         http://sg.danny.cz/sg/p/%name-%{version}.tar.xz
 Patch1:         0001-Split-59-scsi-sg_utils.rules-for-multipath-support.patch
+Patch2:         sginfo-inq-fields-strip-blank.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 BuildRequires:  udev
 BuildRequires:  xz
@@ -82,6 +83,7 @@
 %prep
 %setup -q -n %{name}-%{version}
 %patch1 -p1
+%patch2 -p1
 
 %build
 %configure --disable-static --with-pic

++++++ sginfo-inq-fields-strip-blank.patch ++++++
From: Shirish Pargaonkar <spargaon...@suse.com>
Subject: sg3_utils: Strip out trailing info from vendor info products fields in 
inquiry
commit 1756f3b04d4c45d7a0d78e128786b2a1c619565e
Date:   Tue Apr 15 10:31:23 2014 -0500
Reference: bnc#863357


sginfo <device> prints out various fields such as Vendor and Product in
INQUIRY response with spaces (0x20) characters.
This can confuse scripts some users have.
Strip out those trailing spaces (if any).


signed-of-by: Shirish Pargaonkar <spargaon...@suse.com>
---
diff --git a/src/sginfo.c b/src/sginfo.c
index b27f117..b9f3f77 100644
--- a/src/sginfo.c
+++ b/src/sginfo.c
@@ -155,6 +155,7 @@ static char *device_name;
 #define MAX_BUFFER_SIZE MAX_RESP10_SIZE
 
 #define INQUIRY_RESP_INITIAL_LEN 36
+#define MAX_INQFIELD_LEN 17
 
 #define MAX_HEADS 127
 #define HEAD_SORT_TOKEN 0x55
@@ -3139,11 +3140,23 @@ do_user_page(struct mpage_info * mpi, int decode_in_hex)
     return status;
 }
 
+static void
+inqfieldname(unsigned char *deststr, const unsigned char *srcbuf, int maxlen)
+{
+       int i;
+
+       memset(deststr, '\0', MAX_INQFIELD_LEN);
+       for (i = maxlen - 1; i >= 0 && isspace(srcbuf[i]); --i)
+               ;
+       memcpy(deststr, srcbuf, i + 1);
+}
+
 static int
 do_inquiry(int * peri_type, int * resp_byte6, int inquiry_verbosity)
 {
     int status;
     unsigned char cmd[6];
+    unsigned char fieldname[MAX_INQFIELD_LEN];
     unsigned char *pagestart;
     struct scsi_cmnd_io sci;
 
@@ -3214,14 +3227,17 @@ do_inquiry(int * peri_type, int * resp_byte6, int 
inquiry_verbosity)
     }
     if (x_interface)
         printf("\n");
-    printf("%s%.8s\n", (!x_interface ? "Vendor:                    " : ""),
-           pagestart + 8);
+       inqfieldname(fieldname, pagestart + 8, 8);
+       printf("%s%s\n", (!x_interface ? "Vendor:                    " : ""),
+               fieldname);
 
-    printf("%s%.16s\n", (!x_interface ? "Product:                   " : ""),
-           pagestart + 16);
+       inqfieldname(fieldname, pagestart + 16, 16);
+       printf("%s%s\n", (!x_interface ? "Product:                   " : ""),
+               fieldname);
 
-    printf("%s%.4s\n", (!x_interface ? "Revision level:            " : ""),
-           pagestart + 32);
+       inqfieldname(fieldname, pagestart + 32, 4);
+       printf("%s%s\n", (!x_interface ? "Revision level:            " : ""),
+               fieldname);
 
     printf("\n");
     return status;
-- 
To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org
For additional commands, e-mail: opensuse-commit+h...@opensuse.org

Reply via email to