Closed rivy closed 4 years ago
It looks like the rustc
version is too old. I am using edition 2018, v1.35 .
Can you please check?
Same here on stable-x86_64-pc-windows-msvc unchanged - rustc 1.35.0 (3c235d560 2019-05-20)
Thank you! It's very odd, and seems entirely related to Rustc not understanding the new module rules.
I have cross-posted this in the termion repository - let's see what they say.
I can reproduce this issue with rustc v1.31.1 on Alpine, for instance. Unfortunately I can't get a newer version of rustc there that easily :(.
Problem remains with all rust versions up to v1.35.0.
C:\...\rust\dua-cli>cargo -V
cargo 1.35.0 (6f3e9c367 2019-04-04)
C:\...\rust\dua-cli>rustc -V
rustc 1.35.0 (3c235d560 2019-05-20)
C:\...\rust\dua-cli>ver
Microsoft Windows [Version 10.0.17763.437]
@Byron-TW https://gitlab.redox-os.org/redox-os/termion/issues/139 this lib doesn't support windows .. Supports Redox, Mac OS X, BSD, and Linux (or, in general, ANSI terminals). aha~
As a possible solution, I replaced termion with crossterm for a TUI application and it now works on Windows.
@photex Thanks so much for the hint! Even though I don't have access to Windows, the latest master does use crossterm
in TUI, instead of termion
.
It doesn't actually work that easily due to input handling being different. @photex Do you have a PR that works for you on windows? Maybe termion input handling does work fine despite crossterm doing the drawing.
@Byron-TW I'll check it out on Monday. For my application the only real input is a gamepad actually so I didn't dig in.
Sorry, no joy. The compilation still fails with the same errors for 34274b1.
Triage: it still happens on latest Rust + Windows
> cargo install dua-cli
error: could not compile `termion`.
warning: build failed, waiting for other jobs to finish...
error: failed to compile `dua-cli v2.3.2`
> cargo -V
cargo 1.41.0 (626f0f40e 2019-12-03)
> rustc -V
rustc 1.41.0 (5e1a79984 2020-01-27)
It looks like switching to crossterm as TUI backend and adjusting input handling in DUA is the way to go. Unless Termion will one day be ported to Windows.
I think an easy first step could be to build without TUI on windows, and possibly disable coloring in the little that remains. Now that GitHub actions are coming, it's possible to test a thing or two, see here.
@Byron-TW I successfully built dua-cli
v2.2.0 on Windows 10 using stable rustc 1.42.0 and the windows-support
branch of termion.
In order to do this I added the following before the [dependencies]
in Cargo.toml
:
[patch.crates-io]
termion = { git = "https://gitlab.redox-os.org/Jezza/termion.git", branch = "windows-support" }
Building later versions is only possible with rustc nightly. A workaround to build using rustc stable was discussed in the vector project.
Building version 2.6.0 fails due to src/crossdev.rs
not providing the necessary functions for Windows.
It is recommended to execute dua-cli in a modern Terminal, like Alacritty (which is written in Rust).
Thanks a lot for looking into this! You have sparked hope, because…
src/crossdev.rs
was fixed, that was a bugFor completeness, here is the compatibility MR for termion referenced in the comment above - should that get merged, then dua should be gaining windows support permanently.
Here are some issues encountered on the way:
And finally, now with every release, there will be builds for windows as well :)!
https://github.com/Byron/dua-cli/releases/tag/v2.6.0
@mardukbp Could you validate these are actually working? If so, I think this issue can be closed.
@Byron I tried cargo +nightly install --git https://github.com/Byron/dua-cli.git
and it failed because it is fetching termion from crates.io instead of the git repo with the Windows patch. I tried to specify different sources for termion depending on the platform, but cargo does not support this. All platforms must use the same source for a given crate.
So I added the patch.crates-io section to Cargo.toml and everything worked fine.
Could you try the release binaries published To GitHub releases linked above? The patch section is not added in master as I am not sure what it does for cargo install yet. But releases will now include windows versions whenever I create a new tag.
I tried it with the default Windows shell (cmd.exe), PowerShell, nushell and xonsh. dua i
is only usable in the last two and using Alacritty as terminal emulator.
Besides the UI, dua i
reports incorrect sizes, way smaller than the actual size.
EDIT: dua i
is not calculating the size of subdirectories, only files.
I also noticed that dua
considers 1 MB = 1000 bytes instead of 1024 bytes, which differs from the behavior of Windows Explorer.
EDIT: I just saw that dua
uses "metric" MB by default. Why?
I have added a note to the Readme to communicate the kind of Windows support that is established now. This ticket probably cannot be closed as it talks about compiling on Windows, which still doesn't work on master and on stable. I would expect this to work once Termion gets Windows support and once the unstable feature used on Windows stabilizes, making it a mere matter of time.
Metric MB are used because that's the standard on MacOS I suppose, but there is a --format
flag which allows to change that, e.g. dua -f binary
.
I have just released `dua 2.9 which should bring full windows support powered by crossterm
.
Could you have a look and let me know how it works? I would love to close this issue :).
I tried the MSVC version on Windows 10 with WezTerm and xonsh. It runs. But dua i
still does not calculate the sizes of subdirectories.
Thank you! It's good to see that it works with unix'y shells still, but I would be particularly interested in learning how it fares with cmd.exe and Powershell.
The issue with the incorrect directory sizes is tracked in #53 - what's missing there is a contribution of someone who actually has windows. It's odd the counting doesn't work as I would believe Rust abstracts over this kind of thing.
Thanks for pushing forward on windows support @Byron! 🎉
I haven't fully tested it, but it's now compiling and seems, on first blush, to be working correctly.
As noted, dua i
shows size as 0
for subdirectories (and all files within those directories are shown as 0
size). At the same time though, a simple dua
does seem to show the correct size for files and subdirectories. I'll follow-up on #53 to see if I can help track down the problem.
I created a PR (#60) that fixes a couple of compiler warnings and adds the usually expected wildcard support (for windows).
There is a test error which appears to be some single byte size differences in EntryData
...
>cargo +nightly test
Compiling dua-cli v2.9.0 (C:\Users\Roy\OneDrive\Projects\rust\dua-cli)
Finished test [unoptimized + debuginfo] target(s) in 2.77s
Running target\debug\deps\dua-cbadb0c3e39d4e6a.exe
running 1 test
test inodefilter::tests::it_filters_inodes ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
Running target\debug\deps\dua-b1160d1b01703dd0.exe
running 5 tests
test interactive::app_test::unit::it_can_handle_ending_traversal_without_reaching_the_top ... ignored
test interactive::app::common::tests::fit_string_inputs ... ok
test interactive::app_test::journeys_with_writes::basic_user_journey_with_deletion ... ok
test interactive::app_test::journeys_readonly::simple_user_journey_read_only ... ok
test interactive::app_test::unit::it_can_handle_ending_traversal_reaching_top_but_skipping_levels ... FAILED
failures:
---- interactive::app_test::unit::it_can_handle_ending_traversal_reaching_top_but_skipping_levels stdout ----
thread 'interactive::app_test::unit::it_can_handle_ending_traversal_reaching_top_but_skipping_levels' panicked at 'assertion failed: `(left == right)`: filesystem graph is stable and matches the directory structure
Diff < left / right > :
<"StableGraph { Ty: \"Directed\", node_count: 15, edge_count: 14, edges: (0, 1), (1, 2), (1, 3), (1, 4), (1, 5), (1, 6), (6, 7), (6, 8), (6, 9), (6, 10), (10, 11), (6, 12), (12, 13), (1, 14), node weights: {0: EntryData { name: \"\", size: 1259069, metadata_io_error: false }, 1: EntryData { name: \"tests/fixtures\\\\sample-01\", size: 1259069, metadata_io_error: false }, 2: EntryData { name: \".hidden.666\", size: 666, metadata_io_error: false }, 3: EntryData { name: \"a\", size: 256, metadata_io_error: false }, 4: EntryData { name: \"b.empty\", size: 0, metadata_io_error: false }, 5: EntryData { name: \"c.lnk\", size: 0, metadata_io_error: false }, 6: EntryData { name: \"dir\", size: 1258024, metadata_io_error: false }, 7: EntryData { name: \"1000bytes\", size: 1000, metadata_io_error: false }, 8: EntryData { name: \"dir-a.1mb\", size: 1000000, metadata_io_error: false }, 9: EntryData { name: \"dir-a.kb\", size: 1024, metadata_io_error: false }, 10: EntryData { name: \"empty-dir\", size: 0, metadata_io_error: false }, 11: EntryData { name: \".gitkeep\", size: 0, metadata_io_error: false }, 12: EntryData { name: \"sub\", size: 256000, metadata_io_error: false }, 13: EntryData { name: \"dir-sub-a.256kb\", size: 256000, metadata_io_error: false }, 14: EntryData { name: \"z123.b\", size: 123, metadata_io_error: false }}, free_node: NodeIndex(4294967295), free_edge: EdgeIndex(4294967295) }"
>"StableGraph { Ty: \"Directed\", node_count: 15, edge_count: 14, edges: (0, 1), (1, 2), (1, 3), (1, 4), (1, 5), (1, 6), (6, 7), (6, 8), (6, 9), (6, 10), (10, 11), (6, 12), (12, 13), (1, 14), node weights: {0: EntryData { name: \"\", size: 1259070, metadata_io_error: false }, 1: EntryData { name: \"tests/fixtures\\\\sample-01\", size: 1259070, metadata_io_error: false }, 2: EntryData { name: \".hidden.666\", size: 666, metadata_io_error: false }, 3: EntryData { name: \"a\", size: 256, metadata_io_error: false }, 4: EntryData { name: \"b.empty\", size: 0, metadata_io_error: false }, 5: EntryData { name: \"c.lnk\", size: 1, metadata_io_error: false }, 6: EntryData { name: \"dir\", size: 1258024, metadata_io_error: false }, 7: EntryData { name: \"1000bytes\", size: 1000, metadata_io_error: false }, 8: EntryData { name: \"dir-a.1mb\", size: 1000000, metadata_io_error: false }, 9: EntryData { name: \"dir-a.kb\", size: 1024, metadata_io_error: false }, 10: EntryData { name: \"empty-dir\", size: 0, metadata_io_error: false }, 11: EntryData { name: \".gitkeep\", size: 0, metadata_io_error: false }, 12: EntryData { name: \"sub\", size: 256000, metadata_io_error: false }, 13: EntryData { name: \"dir-sub-a.256kb\", size: 256000, metadata_io_error: false }, 14: EntryData { name: \"z123.b\", size: 123, metadata_io_error: false }}, free_node: NodeIndex(4294967295), free_edge: EdgeIndex(4294967295) }"
', src\interactive\app_test\unit.rs:12:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
failures:
interactive::app_test::unit::it_can_handle_ending_traversal_reaching_top_but_skipping_levels
Closing as fixed (with all tests passing) as of commit 5a36cd18a31ca1fbdc62d4e594933a6327fe4e7d. 🎉
Um... New user just trying out install on Windows... Fails with:
Compiling termion v1.5.5 error[E0433]: failed to resolve: unresolved import --> C:\Users\thordani.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.5\src\lib.rs:24:9 24 | pub use sys::size::terminal_size; unresolved import
I'm on Win10 Version 1909 (OS Build 18363.1139) rustc 1.47.0 (18bf6b4f0 2020-10-07)
@dantho To be able to understand where the issue is coming from, it's important to know how it can be reproduced. I would expect it to work with cargo install dua-cli
, which will not pull in termion at all (it's known to fail on windows).
Not reproduced on my Windows machine. Compiling, testing, and installing correctly (although it still requires nightly for the use of the "features" attribute in src/lib.rs).
C:>ver
Microsoft Windows [Version 10.0.18363.1082]
C:>rustc --version
rustc 1.47.0 (18bf6b4f0 2020-10-07)
C:>cargo +nightly test
...
Finished test [unoptimized + debuginfo] target(s) in 0.25s
Running target\debug\deps\dua-a93d27099610674e.exe
running 1 test
test inodefilter::tests::it_filters_inodes ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
Running target\debug\deps\dua-0849b0478c8e2faa.exe
running 5 tests
test interactive::app::common::tests::fit_string_inputs ... ok
test interactive::app_test::unit::it_can_handle_ending_traversal_reaching_top_but_skipping_levels ... ok
test interactive::app_test::unit::it_can_handle_ending_traversal_without_reaching_the_top ... ok
test interactive::app_test::journeys_with_writes::basic_user_journey_with_deletion ... ok
test interactive::app_test::journeys_readonly::simple_user_journey_read_only ... ok
test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
Doc-tests dua
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
C:>cargo +nightly install --path .
Installing dua-cli v2.10.3 (C:\Users\Roy\OneDrive\Projects\rust\dua-cli)
Updating crates.io index
Downloaded syn v1.0.45
Downloaded 1 crate (225.6 KB) in 0.74s
Compiling autocfg v1.0.1
Compiling cfg-if v0.1.10
Compiling lazy_static v1.4.0
Compiling winapi v0.3.9
Compiling scopeguard v1.1.0
Compiling maybe-uninit v2.0.0
Compiling bitflags v1.2.1
Compiling version_check v0.9.2
Compiling proc-macro2 v1.0.24
Compiling unicode-xid v0.2.1
Compiling libc v0.2.79
Compiling smallvec v1.4.2
Compiling unicode-width v0.1.8
Compiling rayon-core v1.8.1
Compiling syn v1.0.45
Compiling log v0.4.11
Compiling unicode-segmentation v1.6.0
Compiling cassowary v0.3.0
Compiling either v1.6.1
Compiling hashbrown v0.9.1
Compiling vec_map v0.8.2
Compiling strsim v0.8.0
Compiling anyhow v1.0.33
Compiling glob v0.3.0
Compiling utf8-width v0.1.4
Compiling fixedbitset v0.2.0
Compiling crossbeam-utils v0.7.2
Compiling memoffset v0.5.6
Compiling crossbeam-epoch v0.8.2
Compiling indexmap v1.6.0
Compiling rayon v1.4.1
Compiling lock_api v0.3.4
Compiling proc-macro-error-attr v1.0.4
Compiling proc-macro-error v1.0.4
Compiling textwrap v0.11.0
Compiling heck v0.3.1
Compiling itertools v0.9.0
Compiling byte-unit v4.0.9
Compiling wild v2.0.4
Compiling quote v1.0.7
Compiling num_cpus v1.13.0
Compiling crossbeam-channel v0.4.4
Compiling crossbeam-queue v0.2.3
Compiling petgraph v0.5.1
Compiling parking_lot_core v0.7.2
Compiling crossterm_winapi v0.6.1
Compiling atty v0.2.14
Compiling open v1.4.0
Compiling filesize v0.2.0
Compiling crossbeam-deque v0.7.3
Compiling parking_lot v0.10.2
Compiling clap v2.33.3
Compiling colored v2.0.0
Compiling crossbeam v0.7.3
Compiling structopt-derive v0.4.13
Compiling crossterm v0.17.7
Compiling tui v0.12.0
Compiling jwalk v0.5.1
Compiling structopt v0.3.20
Compiling tui-react v0.12.0
Compiling crosstermion v0.4.0
Compiling dua-cli v2.10.3 (C:\Users\Roy\OneDrive\Projects\rust\dua-cli)
Finished release [optimized] target(s) in 2m 30s
Replacing C:\Users\Roy\.cargo\bin\dua.exe
Replaced package `dua-cli v2.10.2` with `dua-cli v2.10.3 (C:\Users\Roy\OneDrive\Projects\rust\dua-cli)` (executable `dua.exe`)
@dantho , how were you trying to install it?