Bug#1011234: fakeroot doesn't correctly detect copied device nodes on ia64

2022-05-22 Thread Clint Adams
On Thu, May 19, 2022 at 10:48:13AM +0200, Mattias Ellert wrote:
> According to
> 
> https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/ia64/xstatver.h;h=f24ab4a9ee158d7f0890cd228b20bf1e278d332b;hb=HEAD
> 
> _STAT_VER should be 1 for ia64.
> 
> The libfakeroot.c has no check for ia64, and uses the default linux
> value of 3.

How long has this been broken?



Bug#1011234: fakeroot doesn't correctly detect copied device nodes on ia64

2022-05-19 Thread Mattias Ellert
Control: tag 1011234 +patch

The attached patch fixes the issue:

Mattias

diff -ur fakeroot-1.28.orig/libfakeroot.c fakeroot-1.28/libfakeroot.c
--- fakeroot-1.28.orig/libfakeroot.c	2022-03-04 14:21:41.0 +
+++ fakeroot-1.28/libfakeroot.c	2022-05-20 04:57:29.491263557 +
@@ -99,6 +99,8 @@
  #if defined __linux__
   #if defined (__aarch64__)
#define _STAT_VER 0
+  #elif defined (__ia64__)
+   #define _STAT_VER 1
   #elif defined (__powerpc__) && __WORDSIZE == 64
#define _STAT_VER 1
   #elif defined (__riscv) && __riscv_xlen==64


smime.p7s
Description: S/MIME cryptographic signature


Bug#1011234: fakeroot doesn't correctly detect copied device nodes on ia64

2022-05-19 Thread Mattias Ellert
tor 2022-05-19 klockan 07:46 +0200 skrev Mattias Ellert:
> Is _STAT_VER correct for ia64?
> 
> https://salsa.debian.org/clint/fakeroot/-/blob/master/libfakeroot.c#L98-L116
> 
> Mattias
> 

According to

https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/ia64/xstatver.h;h=f24ab4a9ee158d7f0890cd228b20bf1e278d332b;hb=HEAD

_STAT_VER should be 1 for ia64.

The libfakeroot.c has no check for ia64, and uses the default linux
value of 3.

Mattias



smime.p7s
Description: S/MIME cryptographic signature


Bug#1011234: fakeroot doesn't correctly detect copied device nodes on ia64

2022-05-18 Thread Mattias Ellert
Is _STAT_VER correct for ia64?

https://salsa.debian.org/clint/fakeroot/-/blob/master/libfakeroot.c#L98-L116

Mattias



signature.asc
Description: This is a digitally signed message part


Bug#1011234: fakeroot doesn't correctly detect copied device nodes on ia64

2022-05-18 Thread Mattias Ellert
tor 2022-05-19 klockan 00:02 + skrev Clint Adams:
> Is the output of
> 
>     strace -e '%%stat' sh -c 'test -c /dev/null'
> 
> conspicuously different on ia64 in contrast with other architectures?

There is no major difference:

x86_64:

ellert@debian-unstable:~$ uname -a
Linux debian-unstable 5.17.0-2-amd64 #1 SMP PREEMPT Debian 5.17.6-1
(2022-05-11) x86_64 GNU/Linux
ellert@debian-unstable:~$ strace -e '%%stat' sh -c 'test -c /dev/null'
newfstatat(3, "", {st_mode=S_IFREG|0644, st_size=107023, ...},
AT_EMPTY_PATH) = 0
newfstatat(3, "", {st_mode=S_IFREG|0755, st_size=1900992, ...},
AT_EMPTY_PATH) = 0
newfstatat(AT_FDCWD, "/home/ellert", {st_mode=S_IFDIR|0755,
st_size=4096, ...}, 0) = 0
newfstatat(AT_FDCWD, ".", {st_mode=S_IFDIR|0755, st_size=4096, ...}, 0)
= 0
newfstatat(AT_FDCWD, "/dev/null", {st_mode=S_IFCHR|0666,
st_rdev=makedev(0x1, 0x3), ...}, 0) = 0
+++ exited with 0 +++

ia64:

ellert@yttrium:~$ uname -a
Linux yttrium 5.17.0-1-mckinley #1 SMP Debian 5.17.3-1 (2022-04-18)
ia64 GNU/Linux
ellert@yttrium:~$ strace -e '%%stat' sh -c '[ -c /dev/null ]'
newfstatat(3, "", {st_mode=S_IFREG|0644, st_size=25579, ...},
AT_EMPTY_PATH) = 0
newfstatat(3, "", {st_mode=S_IFREG|0755, st_size=2937560, ...},
AT_EMPTY_PATH) = 0
newfstatat(AT_FDCWD, "/home/ellert", {st_mode=S_IFDIR|0755,
st_size=4096, ...}, 0) = 0
newfstatat(AT_FDCWD, ".", {st_mode=S_IFDIR|0755, st_size=4096, ...}, 0)
= 0
newfstatat(AT_FDCWD, "/dev/null", {st_mode=S_IFCHR|0666,
st_rdev=makedev(0x1, 0x3), ...}, 0) = 0
+++ exited with 0 +++


yttrium.debian.net is the debian ia64 porterbox, so you can probably
run these test too.


Mattias



signature.asc
Description: This is a digitally signed message part


Bug#1011234: fakeroot doesn't correctly detect copied device nodes on ia64

2022-05-18 Thread Clint Adams
Is the output of

strace -e '%%stat' sh -c 'test -c /dev/null'

conspicuously different on ia64 in contrast with other architectures?



Bug#1011234: fakeroot doesn't correctly detect copied device nodes on ia64

2022-05-18 Thread Mattias Ellert
ons 2022-05-18 klockan 15:03 + skrev Clint Adams:
> On Wed, May 18, 2022 at 04:43:08PM +0200, Mattias Ellert wrote:
> > However, on ia64 it fails:
> > 
> > ellert@yttrium:~$ fakeroot ./fakeroot-test.sh 
> > crw-rw-rw- 1 root root 1, 3 May 10 06:51 /dev/null
> > Original is device
> > crw-rw-rw- 1 root root 1, 3 May 10 06:51 newdev/null
> > Copy is not device
> > ellert@yttrium:~$ echo $?
> > 1
> 
> Could you run `stat` on newdev/null from within the script,
> and comment out the `rm` so that you can run `stat` on it without
> fakeroot afterward?

Replacing "rm -rf newdev" with "stat newdev/null":

ellert@yttrium:~$ fakeroot ./fakeroot-test.sh 
crw-rw-rw- 1 root root 1, 3 May 10 06:51 /dev/null
Original is device
crw-rw-rw- 1 root root 1, 3 May 10 06:51 newdev/null
Copy is not device
  File: newdev/null
  Size: 0   Blocks: 0  IO Block: 4096   character special 
file
Device: 802h/2050d  Inode: 6429907 Links: 1 Device type: 1,3
Access: (0666/crw-rw-rw-)  Uid: (0/root)   Gid: (0/root)
Access: 2022-05-18 15:18:53.847679259 +
Modify: 2022-05-10 06:51:55.0 +
Change: 2022-05-18 15:18:53.847679259 +
 Birth: 2022-05-18 15:18:53.847679259 +
ellert@yttrium:~$ stat newdev/null 
  File: newdev/null
  Size: 0   Blocks: 0  IO Block: 4096   regular empty file
Device: 802h/2050d  Inode: 6429907 Links: 1
Access: (0666/-rw-rw-rw-)  Uid: ( 3156/  ellert)   Gid: ( 3156/  ellert)
Access: 2022-05-18 15:18:53.847679259 +
Modify: 2022-05-10 06:51:55.0 +
Change: 2022-05-18 15:18:53.847679259 +
 Birth: 2022-05-18 15:18:53.847679259 +

Mattias



smime.p7s
Description: S/MIME cryptographic signature


Bug#1011234: fakeroot doesn't correctly detect copied device nodes on ia64

2022-05-18 Thread Clint Adams
On Wed, May 18, 2022 at 04:43:08PM +0200, Mattias Ellert wrote:
> However, on ia64 it fails:
> 
> ellert@yttrium:~$ fakeroot ./fakeroot-test.sh 
> crw-rw-rw- 1 root root 1, 3 May 10 06:51 /dev/null
> Original is device
> crw-rw-rw- 1 root root 1, 3 May 10 06:51 newdev/null
> Copy is not device
> ellert@yttrium:~$ echo $?
> 1

Could you run `stat` on newdev/null from within the script,
and comment out the `rm` so that you can run `stat` on it without
fakeroot afterward?



Bug#1011234: fakeroot doesn't correctly detect copied device nodes on ia64

2022-05-18 Thread Mattias Ellert
Package: fakeroot
Version: 1.26-1
Severity: important
Control: affects -1 globus-gridftp-server

Using the following test script:

$ cat fakeroot-test.sh 
#! /bin/sh
res=0
mkdir newdev
(cd /dev; tar chf - null) | (cd newdev; tar xf -)
ls -l /dev/null
if [ -c /dev/null ] ; then
echo Original is device
else
echo Original is not device
res=1
fi
ls -l newdev/null
if [ -c newdev/null ] ; then
echo Copy is device
else
echo Copy is not device
res=1
fi
rm -rf newdev
exit $res

On most architectures this works as expected:

$ fakeroot ./fakeroot-test.sh 
crw-rw-rw- 1 root root 1, 3 17 maj 10.09 /dev/null
Original is device
crw-rw-rw- 1 root root 1, 3 17 maj 10.09 newdev/null
Copy is device
$ echo $?
0

However, on ia64 it fails:

ellert@yttrium:~$ fakeroot ./fakeroot-test.sh 
crw-rw-rw- 1 root root 1, 3 May 10 06:51 /dev/null
Original is device
crw-rw-rw- 1 root root 1, 3 May 10 06:51 newdev/null
Copy is not device
ellert@yttrium:~$ echo $?
1

fakeroot 1.26-1 is the latest version of fakeroot built for ia64.

Mattias



signature.asc
Description: This is a digitally signed message part