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

/dev/null is a weird file #10

Closed
jernejs opened this issue Apr 7, 2016 · 7 comments
Closed

/dev/null is a weird file #10

jernejs opened this issue Apr 7, 2016 · 7 comments

Comments

@jernejs
Copy link

jernejs commented Apr 7, 2016

That's precisely what stat says:

localhost ~ # stat /dev/null
  File: ‘/dev/null’
  Size: 0               Blocks: 0          IO Block: 512    weird file
Device: 0h/0d   Inode: 0           Links: 0
Access: (0000/?---------)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 1970-01-01 00:00:00.000000000 +0000
Modify: 1970-01-01 00:00:00.000000000 +0000
Change: 1970-01-01 00:00:00.000000000 +0000
 Birth: -

And it's causing problems with some programs (I don't remember what exactly was tripped by this in original userland, but I'm trying to run gentoo userland, and emerge fails sanity checks due to this).

Additionally, it appears there's no way to modify /dev - it always results in Operation not permitted.

@jpyper
Copy link

jpyper commented Apr 7, 2016

Maybe the whole idea behind the Linux/Ubuntu subsystem hasn't been fully implemented yet. The UNIX philosophy is that EVERYTHING is a file. For example, /dev/null is a virtual device file. This means that nothing, is something, and that something is represented in userland as a file.

On my Debian system, I get the following:

john@phobos:~$ stat /dev/null
File: '/dev/null'
Size: 0 Blocks: 0 IO Block: 4096 character special file
Device: 6h/6d Inode: 1037 Links: 1 Device type: 1,3
Access: (0666/crw-rw-rw-) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2016-04-06 20:33:12.884276144 -0700
Modify: 2016-04-06 20:33:12.884276144 -0700
Change: 2016-04-06 20:33:12.884276144 -0700
Birth: -

It looks like the Ubuntu subsystem doesn't see /dev/null as a "character special file" which I would think would redirect to >NUL on Windows.

@jernejs
Copy link
Author

jernejs commented Apr 7, 2016

/dev/null should be a character device with major 1 and minor 3, but it isn't in lxss, so tests like this fail:

[ -c /dev/null ] || echo broken

@poizan42
Copy link

poizan42 commented Apr 7, 2016

Shouldn't it be fine if /dev/null was simply a symlink to \Device\Null?

@thanosk
Copy link

thanosk commented Apr 7, 2016

One side-effect of this breaks sshd (openssh-server), as also mentioned here: MicrosoftDocs/WSL#17

@russalex
Copy link
Contributor

The weird file is a known issue and something we intend to fix. It is currently on our backlog.

@mjgardner
Copy link

Another side-effect: I can't build a different version of Perl, either manually or using the perlbrew package, because its configure script checks for /dev/null's usability.

@ghost
Copy link

ghost commented Aug 24, 2016

anybody want to take a guess at why this is in all of the binaries? https://gist.github.com/cloudkitsch/6f8bcb05f4006b5ea168eb6169ecbf12#file-gistfile1-txt-L335 quality control?

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

No branches or pull requests

6 participants