Skip to contentSkip to conversation

multipath: rlookup WWIDs with spaces by alias

PATCH Applied Benjamin Marzinski 3 participants 5 messages Nov 12, 2011 – Nov 15, 2011 Device mapper

lore
Share & tools
lore

Benjamin Marzinski

author maintainer
#0 lore raw

PATCH 1/1 multipath: rlookup WWIDs with spaces by alias

If a WWID contained spaces, the rlookup code wasn't able to look it up by its user_friendly_name, since the code was only reading the wwid till the first space. It now reads to the end of the line.

---
 libmultipath/alias.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
libmultipath/alias.c +1 -1
Index: multipath-tools-110412/libmultipath/alias.c
===================================================================
@@ -288,7 +288,7 @@ rlookup_binding(FILE *f, char **map_wwid
 		curr_id = scan_devname(alias, NULL); /* TBD: Why this call? */
 		if (curr_id >= id)
 			id = curr_id + 1;
-		wwid = strtok(NULL, " \t");
+		wwid = strtok(NULL, "");
 		if (!wwid){
 			condlog(3,
 				"Ignoring malformed line %u in bindings file",
#1 lore raw
Quoted 4 lines · Benjamin Marzinski

If a WWID contained spaces, the rlookup code wasn't able to look it up by its user_friendly_name, since the code was only reading the wwid till the first space. It now reads to the end of the line.

Applied

Quoted 18 lines
---
 libmultipath/alias.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: multipath-tools-110412/libmultipath/alias.c
===================================================================

libmultipath/alias.c +1 -1
@@ -288,7 +288,7 @@ rlookup_binding(FILE *f, char **map_wwid
 		curr_id = scan_devname(alias, NULL); /* TBD: Why this call? */
 		if (curr_id >= id)
 			id = curr_id + 1;
-		wwid = strtok(NULL, " \t");
+		wwid = strtok(NULL, "");
 		if (!wwid){
 			condlog(3,
 				"Ignoring malformed line %u in bindings file",
#2 lore raw
In reply to Benjamin Marzinski
Quoted 15 lines · Benjamin Marzinski

If a WWID contained spaces, the rlookup code wasn't able to look it up by its user_friendly_name, since the code was only reading the wwid till the first space. It now reads to the end of the line.

---
  libmultipath/alias.c |    2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

Index: multipath-tools-110412/libmultipath/alias.c
===================================================================

libmultipath/alias.c rlookup_binding(FILE *f, char **map_wwid · line 294

Quoted 8 lines
libmultipath/alias.c +1 -1
@@ -288,7 +288,7 @@ rlookup_binding(FILE *f, char **map_wwid
  		curr_id = scan_devname(alias, NULL); /* TBD: Why this call? */
  		if (curr_id>= id)
  			id = curr_id + 1;
-		wwid = strtok(NULL, " \t");
+		wwid = strtok(NULL, "");
  		if (!wwid){
  			condlog(3,
  				"Ignoring malformed line %u in bindings file",

Please, don't.

We keep on changing this one back and forth about every year.
(The original patch was by you, back in 2008. Then I changed it back because it breaks compability with existing configuration files. Now you go and change it _again_).

The real problem here is

'If the WWID contains spaces'

The WWID _never_ should contain spaces. I pretty certain we can't handle WWID with spaces in the bindings file; eg we don't have any quotation mechanism implemented. So can't we just settle on 'The WWID must not contain spaces' ?

Cheers,

Hannes

Signature · 4 lines
Dr. Hannes Reinecke		      zSeries & Storage
[email protected]			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Markus Rex, HRB 16746 (AG Nürnberg)
author maintainer
#3 lore raw
Quoted 31 lines · Hannes Reinecke
Quoted 15 lines · Benjamin Marzinski

If a WWID contained spaces, the rlookup code wasn't able to look it up by its user_friendly_name, since the code was only reading the wwid till the first space. It now reads to the end of the line.

---
  libmultipath/alias.c |    2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

Index: multipath-tools-110412/libmultipath/alias.c
===================================================================

libmultipath/alias.c rlookup_binding(FILE *f, char **map_wwid · line 294

Quoted 8 lines
libmultipath/alias.c +1 -1
@@ -288,7 +288,7 @@ rlookup_binding(FILE *f, char **map_wwid
  		curr_id = scan_devname(alias, NULL); /* TBD: Why this call? */
  		if (curr_id>= id)
  			id = curr_id + 1;
-		wwid = strtok(NULL, " \t");
+		wwid = strtok(NULL, "");
  		if (!wwid){
  			condlog(3,
  				"Ignoring malformed line %u in bindings file",

Please, don't.

We keep on changing this one back and forth about every year. (The original patch was by you, back in 2008. Then I changed it back because it breaks compability with existing configuration files. Now you go and change it _again_).

Quoted 8 lines

The real problem here is

'If the WWID contains spaces'

The WWID _never_ should contain spaces. I pretty certain we can't handle WWID with spaces in the bindings file; eg we don't have any quotation mechanism implemented.
So can't we just settle on 'The WWID must not contain spaces' ?

I suppose that since we're using the "--replace-whitespace" option to scsi_id by default, I'm fine with not including this patch.

-Ben

Quoted 9 lines

Cheers,

Hannes

Signature · 4 lines
Dr. Hannes Reinecke		      zSeries & Storage
[email protected]			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Markus Rex, HRB 16746 (AG Nürnberg)
#4 lore raw
Quoted 36 lines · Benjamin Marzinski
Quoted 35 lines · Hannes Reinecke
Quoted 15 lines · Benjamin Marzinski

If a WWID contained spaces, the rlookup code wasn't able to look it up by its user_friendly_name, since the code was only reading the wwid till the first space. It now reads to the end of the line.

---
  libmultipath/alias.c |    2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

Index: multipath-tools-110412/libmultipath/alias.c
===================================================================

libmultipath/alias.c rlookup_binding(FILE *f, char **map_wwid · line 294

Quoted 8 lines
libmultipath/alias.c +1 -1
@@ -288,7 +288,7 @@ rlookup_binding(FILE *f, char **map_wwid
  		curr_id = scan_devname(alias, NULL); /* TBD: Why this call? */
  		if (curr_id>= id)
  			id = curr_id + 1;
-		wwid = strtok(NULL, " \t");
+		wwid = strtok(NULL, "");
  		if (!wwid){
  			condlog(3,
  				"Ignoring malformed line %u in bindings file",

Please, don't.

We keep on changing this one back and forth about every year. (The original patch was by you, back in 2008. Then I changed it back because it breaks compability with existing configuration files. Now you go and change it _again_).

The real problem here is

'If the WWID contains spaces'

Quoted 8 lines
Quoted 4 lines

The WWID _never_ should contain spaces. I pretty certain we can't handle WWID with spaces in the bindings file; eg we don't have any quotation mechanism implemented.
So can't we just settle on 'The WWID must not contain spaces' ?

I suppose that since we're using the "--replace-whitespace" option to scsi_id by default, I'm fine with not including this patch.

Reverted.

Signature · 3 lines
Christophe Varoqui
OpenSVC - Tools to scale
http://www.opensvc.com/