Don't run "dpkg" or "dselect" under 2.1.4[45] (was Re: 2.1.45: chmod -R causes reboot)

Kevin Buhr (buhr@stat.wisc.edu)
20 Jul 1997 14:25:14 -0500


Andrea Arcangeli <arcangeli@mbox.queen.it> writes:
>
> I am using [2.1.45].
>
> I didn't tried to chown -R, but I am getting problems tring to install
> debian packages that made a lot of symlinks (such us library packages).
> The problem maybe caused when the dpkg try to chown a symlink or overwrite
> a symlink or so on. I get a lot of *.dpkg-new files that should be
> renamed without the ".dpkg-new" part of the filename.

Don't run "dpkg" or "dselect" under 2.1.44 or 2.1.45. Both these
kernels follow symlinks on "sys_rmdir", "sys_rename", and "sys_chown".
The first breaks "dpkg" most severely, since "dpkg" absolutely relies
on a "rmdir" of a symlink returning ENOTDIR. The second is nasty too,
since "dpkg", when installing a symlink "blahblah", creates the
symlink "blahblah.dpkg-new" and then renames it to "blahblah". The
"sys_chown" problem is mostly minor, but if "dpkg" installs a dangling
symlink, it'll die when the chown of the symlink unexpectedly fails.

The first two problems are fixed in 2.1.46. You can apply the
following patch (only for the i386 architecture) to fix the third. Of
course, the correct solution is to eliminate all the tomfoolery that
"dpkg" applies to symlinks in the first place: none of it's necessary,
and some of it's completely broken.

Anyway, with 2.1.46 and the below patch, I haven't found any other
problems with running "dpkg".

Kevin <buhr@stat.wisc.edu>

* * *

A patch, against 2.1.46, to maintain backwards-compatible "chown"
behaviour. This only works for "i386", but the extension to other
architectures makes for an easy exercise.

Index: linux/arch/i386/kernel/entry.S
diff -u linux/arch/i386/kernel/entry.S:1.1.1.1 linux/arch/i386/kernel/entry.S:1.2
--- linux/arch/i386/kernel/entry.S:1.1.1.1 Thu Jul 17 12:51:27 1997
+++ linux/arch/i386/kernel/entry.S Sat Jul 19 16:51:56 1997
@@ -372,7 +372,7 @@
.long SYMBOL_NAME(sys_time)
.long SYMBOL_NAME(sys_mknod)
.long SYMBOL_NAME(sys_chmod) /* 15 */
- .long SYMBOL_NAME(sys_chown)
+ .long SYMBOL_NAME(sys_lchown)
.long SYMBOL_NAME(sys_break)
.long SYMBOL_NAME(sys_stat)
.long SYMBOL_NAME(sys_lseek)
@@ -528,6 +528,7 @@
.long SYMBOL_NAME(sys_nfsservctl)
.long SYMBOL_NAME(sys_setresgid) /* 170 */
.long SYMBOL_NAME(sys_getresgid)
- .rept NR_syscalls-171
+ .long SYMBOL_NAME(sys_chown)
+ .rept NR_syscalls-172
.long SYMBOL_NAME(sys_ni_syscall)
.endr
Index: linux/include/asm-i386/unistd.h
diff -u linux/include/asm-i386/unistd.h:1.1.1.1 linux/include/asm-i386/unistd.h:1.2
--- linux/include/asm-i386/unistd.h:1.1.1.1 Thu Jul 17 12:45:28 1997
+++ linux/include/asm-i386/unistd.h Sat Jul 19 16:53:40 1997
@@ -21,7 +21,7 @@
#define __NR_time 13
#define __NR_mknod 14
#define __NR_chmod 15
-#define __NR_chown 16
+#define __NR_lchown 16
#define __NR_break 17
#define __NR_oldstat 18
#define __NR_lseek 19
@@ -177,6 +177,7 @@
#define __NR_nfsservctl 169
#define __NR_setresgid 170
#define __NR_getresgid 171
+#define __NR_chown 172

/* user-visible error numbers are in the range -1 - -122: see <asm-i386/errno.h> */