Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non-regular file removal test fails on GNU/Hurd #1116

Closed
mestia opened this issue May 2, 2018 · 5 comments
Closed

Non-regular file removal test fails on GNU/Hurd #1116

mestia opened this issue May 2, 2018 · 5 comments

Comments

@mestia
Copy link

mestia commented May 2, 2018

While building zstd on GNU/Hurd the following test fail:

skip>

test : file removal

Read : 0 / 0 MB ==> 32%

tmp : 32.42% ( 65537 => 21246 bytes, tmp.zst)

tmp.zst : 0 MB...

tmp.zst : 65537 bytes
test : should quietly not remove non-regular file
Makefile:306: recipe for target 'zstd-playTests' failed
make[3]: *** [zstd-playTests] Error 1

The complete build log lives here.
Any idea what might be wrong there? Thanks!

@terrelln
Copy link
Contributor

terrelln commented May 2, 2018

@mestia does /dev/zero exist on GNU/Hurd?

We need to test writing to some non-regular that isn't /dev/null, since we special case /dev/null.

If /dev/zero doesn't exist, we need to add another case here to special case GNU/Hurd, and it must be a non-regular file (where this line gets triggered).

@mestia mestia changed the title File removal test fails on GNU/Hurd Non-regular file removal test fails on GNU/Hurd May 3, 2018
@mestia
Copy link
Author

mestia commented May 3, 2018

@terrelln /dev/zero exists:

ls -l /dev/null
crw-rw-rw- 1 root root 0, 0 Jun 12  2017 /dev/null
file /dev/zero                                                                                                                                                                                                    :(
/dev/zero: character special (0/0)

Looking on the test more precisely, i realized that $INTONUL variable is not defined. Could it be a typo?
Apart from that all works as expected:

root@hurd /tmp/xx # export INTOVOID="/dev/null"
root@hurd /tmp/xx # export DEVDEVICE="/dev/zero"
root@hurd /tmp/xx # export ZSTD=~/pkg/libzstd/programs/zstd
root@hurd /tmp/xx # echo hello >tmp
root@hurd /tmp/xx # $ZSTD tmp -f -o "$DEVDEVICE" 2>tmplog > "$INTOVOID"
1 root@hurd /tmp/xx # cat tmplog                                                                                                                                                                                                        :(
tmp                  :316.67%   (     6 =>     19 bytes, /dev/zero)
zstd: /dev/zero: (os/kern) successful
zstd: Refusing to remove non-regular file /dev/zero
root@hurd /tmp/xx # rm -f tmplog
root@hurd /tmp/xx # $ZSTD tmp -f -o "$INTONULL" 2>&1 | grep -v "Refusing to remove non-regular file"
zstd: : No such file or directory

I wonder now, why it is working on all other architectures.

@terrelln
Copy link
Contributor

terrelln commented May 3, 2018

Nice catch! It should be $INTOVOID. Since the grep succeeds the pipeline exits zero, but I guess GNU/Hurd still fails when zstd fails but grep succeeds.

@mestia mestia closed this as completed May 3, 2018
terrelln added a commit to terrelln/zstd that referenced this issue May 3, 2018
Thanks to @mestia for reporting and finding the bug!
Fixes facebook#1116.
@mestia
Copy link
Author

mestia commented May 8, 2018

Sorry for coming back, but I realized that the actual issue is still there.

$ZSTD tmp -f -o /dev/zero; echo $?
tmp                  :316.67%   (     6 =>     19 bytes, /dev/zero)
zstd: /dev/zero: (os/kern) successful
zstd: Refusing to remove non-regular file /dev/zero
1

The test in the line 176 fails.

Simply echoing to /dev/zero on Gnu/Hurd produces the same error:

echo test > /dev/zero; echo $? 
echo: write error: (os/kern) successful
1

I guess this is some kernel specific feature on this architecture.
On amd64 host it works just fine.
A non-regular files where writing not causing errors on Hurd are /dev/random or /dev/urandom, though not sure if it is correct to write to these files.

@mestia mestia reopened this May 8, 2018
@terrelln
Copy link
Contributor

terrelln commented May 8, 2018

Thanks @mestia, that should work. Writing to /dev/random seeds the entropy pool, so it is perfectly fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants