Skip to contentSkip to conversation

namei: align missing files with rest of the print out

PATCH Applied Sami Kerola 2 participants 3 messages Nov 20, 2013 – Dec 2, 2013 1 message not in the archive Util-Linux package

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 2/2 namei: align missing files with rest of the print out

This change should make namei output more readable when multiple arguments are supplied.

The old:

$ namei -l /usr/foo
f: /usr/foo
drwxr-xr-x root root /
drwxr-xr-x root root usr
foo - No such file or directory

The new:

$ namei -l /usr/foo
f: /usr/foo
drwxr-xr-x root root /
drwxr-xr-x root root usr
                     foo - No such file or directory
---
 misc-utils/namei.c         | 9 +++++++++
 tests/expected/namei/logic | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)
misc-utils/namei.c +9 -0
index a9c8301..1152ea7 100644
@@ -367,6 +367,15 @@ print_namei(struct namei *nm, char *path)
 		char md[11];
 
 		if (nm->noent) {
+			int blanks = 1;
+			if (flags & NAMEI_MODES)
+				blanks += 9;
+			if (flags & NAMEI_OWNERS)
+				blanks += uwidth + gwidth + 2;
+			if (!(flags & NAMEI_VERTICAL))
+				blanks += 1;
+			blanks += nm->level * 2;
+			printf("%*s ", blanks, "");
 			printf(_("%s - No such file or directory\n"), nm->name);
 			return -1;
 		}
tests/expected/namei/logic +1 -1
index 9632db0..8e217d9 100644
@@ -10,4 +10,4 @@ f: namei1/namei2/a/b
  d namei1
  d namei2
  - a
-b - No such file or directory
+   b - No such file or directory
Signature · 1 line
1.8.4.2
maintainer Applied
#2 lore raw
Quoted 3 lines · Sami Kerola
 misc-utils/namei.c         | 9 +++++++++
 tests/expected/namei/logic | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

Applied, thanks.

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com
maintainer Applied
#3 lore raw

Re: [PATCH 1/2] losetup, agetty: remove unnecessary if's before free()

In reply to a message not in the archive
Quoted 3 lines · Sami Kerola
 sys-utils/losetup.c | 6 ++----
 term-utils/agetty.c | 6 ++----
 2 files changed, 4 insertions(+), 8 deletions(-)

Applied, thanks.

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com