-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
touch: implement -
#3158
touch: implement -
#3158
Conversation
This is failing on windows:
|
Do you know of there's a good cross-platform way to get a Path to stdout? The GNU touch just uses the file descriptor number (1) - wasn't sure how to do that in Rust idiomatically |
dunno, maybe look at other tests ? :)
S
|
Seems like this will be tricky, the only option I've found so far to support this is to do std::io::StdOut, convert it to a raw file handle, and then call this unsafe Windows API: https://microsoft.github.io/windows-docs-rs/doc/windows/Win32/Storage/FileSystem/fn.GetFinalPathNameByHandleA.html Will set up a windows VM soon and try it out. |
Almost got it, there's some gross <?> in the output probably because I am not navigating the string conversions correctly. |
Ok, I think this should be okay for now. This is my first time doing unsafe Rust and using Win32 APIs, so there may be improvements to be made. |
Not really sure what is causing this CI failure: https://github.com/uutils/coreutils/runs/5267054489?check_suite_focus=true#step:12:318 |
I've never seen that before, but it might indeed be unrelated. We'll see if it oersists on this run |
I did do some UTF-16 string stuff here, maybe it's not impossible I've inadvertently caused some spooky action at a distance. |
This function has a comment about the same function I'm using : coreutils/tests/common/util.rs Lines 770 to 776 in 8e79b7f
maybe I've done something not thread-safe. Investigating further |
Wasn't able to reproduce using this setup on Windows 11:
Very weird. I'll see if I can get closer to the CI environment when I have time. |
oh wait! I repro'd it locally (turns out |
I think they're due to another PR (https://github.com/uutils/coreutils/pull/3182/checks), so you don't have to fix them :) |
Wahou |
@sylvestre @tertsdiepraam - should I rebase onto |
Preferably rebase, but I don't think it's necessary. GitHub executes the actions on a temporary commit that merges your branch into |
27d8872
to
ef689c9
Compare
Never done a rebase like that so I think I might have messed up the history a little. |
cool:
|
Closes #3157
Issues:
Still doesn't seem to pass the GNU empty-file testnevermind, it passes, I just forgot to rebuild after fixing it.Solution isn't portable (just opens/dev/fd/1
)On Windows, involves a bunch of low-level unsafe codenot really an issue I guess since it is standard across uutils to usewinapi