Subject: [alpine-aports] [PATCH] Fix for http://bugs.alpinelinux.org/issues/4802 Looks like musl getopt_long is not setting optopt the way iscsiadm expects. This seems to fix the issue

From: Brian Angus <[email-masked]>
Date: Wed, 8 Jun 2016 17:08:25 -0600

---
 main/open-iscsi/APKBUILD         |  8 ++++----
 main/open-iscsi/musl-fixes.patch | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+), 4 deletions(-)

diff --git a/main/open-iscsi/APKBUILD b/main/open-iscsi/APKBUILD
index 6418d39..db0eef6 100644
--- a/main/open-iscsi/APKBUILD
+++ b/main/open-iscsi/APKBUILD
@@ -2,7 +2,7 @@
 pkgname=open-iscsi
 pkgver=2.0.873
 _realver=${pkgver%.*}-${pkgver##*.}
-pkgrel=3
+pkgrel=4
 pkgdesc="High performance, transport independent, multi-platform
iSCSI initiator"
 url="http://www.open-iscsi.org"
 arch="all"
@@ -48,14 +48,14 @@ package() {
 }

 md5sums="8b8316d7c9469149a6cc6234478347f7  open-iscsi-2.0-873.tar.gz
-080961aef6eb9d0e8e5f65cf95411225  musl-fixes.patch
+4883782865d664988fb9319220d58442  musl-fixes.patch
 c6a0c15c0c21b13915179fb7e0cf0003  iscsid.initd
 b762b687d4628791b4362df22cf22d34  iscsid.confd"
 sha256sums="7dd9f2f97da417560349a8da44ea4fcfe98bfd5ef284240a2cc4ff8e88ac7cd9
 open-iscsi-2.0-873.tar.gz
-44acaab8123abb8a205732baba11e1c70bcf828dfd3ac5c42c475ee85b433507
musl-fixes.patch
+73a063b65580041faa28af3f89cff99fecc89532aa72d782bd2c92220ae6f5b3
musl-fixes.patch
 38edede472f478ce01f40e3557c315de3f3ecf1d0c0dbab2883517840a7186b5  iscsid.initd
 673bf4744efc3276d372587c996270821d39dcdc0bf27a13691ea6b0e814b6d0  iscsid.confd"
 sha512sums="4e67116cb7dd49381c9279645e5a661f05596ae6be3b832772089828b3764ca2d04b5dea1bcc337071efb52c3c75a6fb943136c659ee59500f3a198ed0dcea6b
 open-iscsi-2.0-873.tar.gz
-d40f6f14d848f2d8a2fdb11672be9b9147b71a72ac06b33f771bbe80e5fa4b5d92405df7f8978e8cd1779820e9797473bd55fc07b4f49d32c5279ac0fb39c93f
 musl-fixes.patch
+82bf13cab7de1259dba2a242b9b9935c49742716a8f8e4c8ed00fedccb9c50cfeca5c12a18857351b25cea7dbb1fb8e34ece92c9830e19aa04717f514adee21d
 musl-fixes.patch
 e16d0abf117c0c282e98abb14893923609dc6078f770facd0578ad72ce6e3fc7b9c84a39628c1246d955ba6bb204fb902bcba6d5959ac755fee7e2a85da181df
 iscsid.initd
 075bb9cb783be7ccbc799947e0e042b85310d40b3045141dc1be40ca84ed1cc0e1e54559df501c512c179e28375314b27a03c15d9a6d4b1cabd428b2279985d3
 iscsid.confd"
diff --git a/main/open-iscsi/musl-fixes.patch b/main/open-iscsi/musl-fixes.patch
index 35f11e1..451be15 100644
--- a/main/open-iscsi/musl-fixes.patch
+++ b/main/open-iscsi/musl-fixes.patch
@@ -29,3 +29,35 @@
  #include <dirent.h>
  #include <limits.h>
  #include <sys/stat.h>
+--- ./usr/iscsiadm.c.orig
++++ ./usr/iscsiadm.c
+@@ -2429,7 +2429,6 @@
+ _ log_init(program_name, 1024, log_do_log_std, NULL);
+ _ sysfs_init();
+
+-_ optopt = 0;
+ _ while ((ch = getopt_long(argc, argv, short_options,
+ _ _   _   _    long_options, &longindex)) >= 0) {
+ _ _   switch (ch) {
+@@ -2553,6 +2552,9 @@
+ _ _   _   return 0;
+ _ _   case 'h':
+ _ _   _   usage(0);
++_ _   default:
++_ _   _   rc = ISCSI_ERR_INVAL;
++_ _   _   goto free_ifaces;
+ _ _   }
+
+ _ _   if (name && value) {
+@@ -2568,11 +2570,6 @@
+ _ _   }
+ _ }
+
+-_ if (optopt) {
+-_ _   log_error("unrecognized character '%c'", optopt);
+-_ _   rc = ISCSI_ERR_INVAL;
+-_ _   goto free_ifaces;
+-_ }
+
+ _ if (killiscsid >= 0) {
+ _ _   kill_iscsid(killiscsid);
--
2.8.3

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---