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

tty device timestamps are not meaningful #545

Closed
krader1961 opened this issue Jun 17, 2016 · 3 comments
Closed

tty device timestamps are not meaningful #545

krader1961 opened this issue Jun 17, 2016 · 3 comments

Comments

@krader1961
Copy link

I was interested in solving a problem with the fish shell so I did some debugging. It appears that the timestamps in the struct stat returned by fstat(1,...) are always the current time. Both on Cygwin and WSL. The workaround for Cygwin is to disable the check of those timestamps based on the definition of macros such as _WIN32. Those conditional checks don't work on WSL.

How can I test, at compile time, that the program is targeted for WSL? If that isn't possible how do I test at run time that the program is running under WSL?

@krader1961
Copy link
Author

how do I test at run time that the program is running under WSL?

The answer to that question appears to be look for "Microsoft" in the output of /proc/version. But that doesn't appear in the output of uname -a. So should I check the output of uname -n?

@benhillis
Copy link
Member

benhillis commented Jun 17, 2016

I'd suggest using /proc/sys/kernel/osrelease which will be "3.4.0-Microsoft" I didn't see anything Microsoft-specific in any of the uname -a output.

I'll take a look at why the tty stat call is always returning the current time.

floam added a commit to fish-shell/fish-shell that referenced this issue Jun 25, 2016
microsoft/WSL#545

Just looking for "Mirosoft" is rather general - we don't want to
enforce this strange behavior for Windows 12 (or the next beta.)
floam added a commit to floam/fish-shell that referenced this issue Jul 4, 2016
microsoft/WSL#545

Just looking for "Mirosoft" is rather general - we don't want to
enforce this strange behavior for Windows 12 (or the next beta.)
@jackchammons
Copy link
Contributor

wsl_version

Build 15032

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

3 participants