rpms/util-linux/devel util-linux-2.13-namei-logic.patch, NONE, 1.1 util-linux-2.12a-raw-man-dd.patch, 1.1, 1.2 util-linux-2.13-mount-context.patch, 1.3, 1.4 util-linux.spec, 1.148, 1.149
fedora-cvs-commits at redhat.com
fedora-cvs-commits at redhat.com
Fri Dec 15 17:05:57 UTC 2006
Author: kzak
Update of /cvs/dist/rpms/util-linux/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv8272
Modified Files:
util-linux-2.12a-raw-man-dd.patch
util-linux-2.13-mount-context.patch util-linux.spec
Added Files:
util-linux-2.13-namei-logic.patch
Log Message:
* Fri Dec 15 2006 Karel Zak <kzak at redhat.com> 2.13-0.47
- fix #217240 - namei ignores non-directory components instead of saying "Not a directory"
- fix #217241 - namei enforces symlink limits inconsistently
- Resolves: rhbz#217240 rhbz#217241
util-linux-2.13-namei-logic.patch:
namei.1 | 4 ----
namei.c | 39 +++++++++++++++++++++++++++++++--------
2 files changed, 31 insertions(+), 12 deletions(-)
--- NEW FILE util-linux-2.13-namei-logic.patch ---
--- util-linux-2.13-pre7/misc-utils/namei.1.nodir 2006-12-15 10:58:38.000000000 +0100
+++ util-linux-2.13-pre7/misc-utils/namei.1 2006-12-15 10:58:51.000000000 +0100
@@ -52,9 +52,5 @@
Roger Southwick (rogers at amadeus.wr.tek.com)
.SH BUGS
To be discovered.
-.SH CAVEATS
-.I Namei
-will follow an infinite loop of symbolic links forever. To escape, use
-SIGINT (usually ^C).
.SH "SEE ALSO"
ls(1), stat(1)
--- util-linux-2.13-pre7/misc-utils/namei.c.nodir 2006-12-14 21:38:41.000000000 +0100
+++ util-linux-2.13-pre7/misc-utils/namei.c 2006-12-15 10:58:31.000000000 +0100
@@ -42,6 +42,10 @@
1999-02-22 Arkadiusz Mi¶kiewicz <misiek at pld.ORG.PL>
- added Native Language Support
+2006-12-15 Karel Zak <kzak at redhat.com>
+- fixed logic; don't follow the path if a component is not directory
+- fixed infinite loop of symbolic links; stack size is very limited
+
-------------------------------------------------------------*/
#include <stdio.h>
@@ -66,7 +70,7 @@
#endif
static char *pperm(unsigned short);
-static void namei(char *, int);
+static void namei(char *, int, mode_t *);
static void usage(void);
int
@@ -107,9 +111,10 @@
for(; optind < argc; optind++){
+ mode_t lastmode = 0;
(void)printf("f: %s\n", argv[optind]);
symcount = 1;
- namei(argv[optind], 0);
+ namei(argv[optind], 0, &lastmode);
if(chdir(curdir) == -1){
(void)fprintf(stderr,
@@ -131,8 +136,10 @@
#define NODEV (dev_t)(-1)
#endif
+int kzak;
+
static void
-namei(char *file, int lev) {
+namei(char *file, int lev, mode_t *lastmode) {
char *cp;
char buf[BUFSIZ], sym[BUFSIZ];
struct stat stb;
@@ -143,7 +150,7 @@
* See if the file has a leading /, and if so cd to root
*/
- if(*file == '/'){
+ if(file && *file == '/'){
while(*file == '/')
file++;
@@ -166,7 +173,7 @@
(void)printf(" d /\n");
}
- for(;;){
+ for(; file && *file;){
if (strlen(file) >= BUFSIZ) {
fprintf(stderr,_("namei: buf overflow\n"));
@@ -198,6 +205,20 @@
for(i = 0; i < lev; i++)
(void)printf(" ");
+
+ /*
+ * Previous element in the path wasn't directory, it means
+ * we cannot walk on *path* and check the actual element by lstat(), because
+ * there could be a component with same name. Try:
+ *
+ * $ touch a b
+ * $ namei a/b <-- "a" is not directory so namei shouldn't check for "b"
+ */
+ if (*lastmode && S_ISDIR(*lastmode)==0 && S_ISLNK(*lastmode)==0){
+ (void)printf(" ? %s - %s (%d)\n", buf, strerror(ENOENT), ENOENT);
+ return;
+ }
+
/*
* See what type of critter this file is
*/
@@ -207,6 +228,8 @@
return;
}
+ *lastmode = stb.st_mode;
+
switch(stb.st_mode & S_IFMT){
case S_IFDIR:
@@ -241,7 +264,6 @@
* Sigh, another symlink. Read its contents and
* call namei()
*/
-
bzero(sym, BUFSIZ);
if(readlink(buf, sym, BUFSIZ) == -1){
(void)printf(_(" ? problems reading symlink %s - %s (%d)\n"), buf, ERR);
@@ -255,11 +277,12 @@
if(symcount > 0 && symcount++ > MAXSYMLINKS){
(void)printf(_(" *** EXCEEDED UNIX LIMIT OF SYMLINKS ***\n"));
- symcount = -1;
} else {
(void)printf("\n");
- namei(sym, lev + 1);
+ namei(sym, lev + 1, lastmode);
}
+ if (symcount > MAXSYMLINKS)
+ return;
break;
case S_IFCHR:
util-linux-2.12a-raw-man-dd.patch:
raw.8 | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
Index: util-linux-2.12a-raw-man-dd.patch
===================================================================
RCS file: /cvs/dist/rpms/util-linux/devel/util-linux-2.12a-raw-man-dd.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- util-linux-2.12a-raw-man-dd.patch 12 Jun 2006 11:38:50 -0000 1.1
+++ util-linux-2.12a-raw-man-dd.patch 15 Dec 2006 17:05:55 -0000 1.2
@@ -8,8 +8,8 @@
+Although Linux includes support for rawio, it is now a deprecated interface. If
+your application performs device access using this interface, Red Hat
+encourages you to modify your application to open the block device with the
-+O_DIRECT flag. The rawio interface will exist for the life of Red Hat
-+Enterprise Linux 4, but is a candidate for removal from future releases.
++O_DIRECT flag. The rawio interface is a candidate for removal from future releases.
++
.SH DESCRIPTION
.B raw
is used to bind a Linux raw character device to a block device. Any
util-linux-2.13-mount-context.patch:
Makefile.am | 3 +
mount.8 | 44 +++++++++++++++++++++++
mount.c | 113 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-----
3 files changed, 152 insertions(+), 8 deletions(-)
Index: util-linux-2.13-mount-context.patch
===================================================================
RCS file: /cvs/dist/rpms/util-linux/devel/util-linux-2.13-mount-context.patch,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- util-linux-2.13-mount-context.patch 14 Dec 2006 12:42:01 -0000 1.3
+++ util-linux-2.13-mount-context.patch 15 Dec 2006 17:05:55 -0000 1.4
@@ -79,11 +79,11 @@
+ if (verbose)
+ printf(_("mount: translated %s '%s' to '%s'\n"),
+ optname, data, (char *) raw);
-+ // TODO 2.6.19: context options with commans are unsupported by kernel now ;-(
-+ bufsz = strlen(optname) + strlen(raw) + 2; // bufsz = strlen(optname) + strlen(raw) + 4; /* 4 is \0, '=' and 2x '"' */
++
++ bufsz = strlen(optname) + strlen(raw) + 4; /* 4 is \0, '=' and 2x '"' */
+ buf = xmalloc(bufsz);
+
-+ snprintf(buf, bufsz, "%s=%s", optname, (char *) raw); // snprintf(buf, bufsz, "%s=\"%s\"", optname, (char *) raw);
++ snprintf(buf, bufsz, "%s=\"%s\"", optname, (char *) raw);
+ freecon(raw);
+
+ if ((*len -= bufsz-1) > 0)
Index: util-linux.spec
===================================================================
RCS file: /cvs/dist/rpms/util-linux/devel/util-linux.spec,v
retrieving revision 1.148
retrieving revision 1.149
diff -u -r1.148 -r1.149
--- util-linux.spec 14 Dec 2006 13:29:39 -0000 1.148
+++ util-linux.spec 15 Dec 2006 17:05:55 -0000 1.149
@@ -9,7 +9,7 @@
Summary: A collection of basic system utilities.
Name: util-linux
Version: 2.13
-Release: 0.46%{?dist}
+Release: 0.47%{?dist}
License: distributable
Group: System Environment/Base
@@ -237,6 +237,9 @@
Patch259: util-linux-2.13-fdisk-b-4096.patch
# leaking file descriptor
Patch260: util-linux-2.13-more-CLOEXEC.patch
+# 217240 - namei ignores non-directory components instead of saying "Not a directory"
+# 217241 - namei enforces symlink limits inconsistently
+Patch261: util-linux-2.13-namei-logic.patch
# When adding patches, please make sure that it is easy to find out what bug # the
# patch fixes.
@@ -336,6 +339,7 @@
%patch258 -p1
%patch259 -p1
%patch260 -p1
+%patch261 -p1
%build
unset LINGUAS || :
@@ -746,6 +750,10 @@
/sbin/losetup
%changelog
+* Fri Dec 15 2006 Karel Zak <kzak at redhat.com> 2.13-0.47
+- fix #217240 - namei ignores non-directory components instead of saying "Not a directory"
+- fix #217241 - namei enforces symlink limits inconsistently
+
* Wed Dec 14 2006 Karel Zak <kzak at redhat.com> 2.13-0.46
- fix leaking file descriptor in the more command (patch by Steve Grubb)
More information about the fedora-cvs-commits
mailing list