Skip to content

install: implement it - #248

Open
metif12 wants to merge 2 commits into
vlang:mainfrom
metif12:install-implementation
Open

metif12 wants to merge 2 commits into
vlang:mainfrom
metif12:install-implementation

Conversation

@metif12

@metif12 metif12 commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

install copies files and sets their mode, with -m, -D, -t, -C, -p, -b, -v, the long -- spellings, multiple sources and multiple operands.

Operand handling and the copy live in common/install; src/install is a five-line main.

-t was the subtle part, and it was a real bug rather than a style choice: with -t DIRECTORY the directory belongs to the option, so every operand is a source. My first version pushed the directory into the operand list, which made the copy try to stat its own destination as an input and fail with cannot stat .: No such file or directory. It is fixed, and test_parse_args_target_directory_is_not_a_source pins it with the bug described in a comment.

-D creates the leading directories before copying, and -C leaves an existing destination alone rather than overwriting it.

Four error diagnostics were compared byte-for-byte against GNU 9.4 through WSL: an invalid mode, no operands at all, a single operand with no destination, and a source that does not exist. All four match, including the quoting around the path.

uutils 0.0.17 ships no install for Windows, so there is no TestRig here and WSL is the reference. That is stated in the test file rather than left implied.

One platform note: mode bits map onto the read-only attribute, as with chmod, and the suite pins that mapping natively because a Windows process cannot set Unix bits on a WSL path. I deliberately did not assert that -m 640 yields mode 0640 here — that would be claiming something the platform cannot do.

Not implemented, and refused rather than faked: -s needs an external strip program, -g and -o need Windows account lookup, and --preserve-timestamps copies content but not the times, because V exposes no utime call.

Copies files and sets their mode, with -m, -D, -t, -C, -p, -b, -v, the long -- spellings, multiple sources and multiple operands. Operand handling and the copy live in common/install; src/install is a five-line main. The -t option was the subtle part, and it was a real bug rather than a style choice: with -t DIRECTORY the directory belongs to the option, so every operand is a source, and my first version pushed the directory into the operand list, which made the copy try to stat its own destination as an input. -D creates the leading directories before copying, and -C leaves an existing destination alone. Four error diagnostics were compared byte-for-byte against GNU 9.4 through WSL: an invalid mode, no operands at all, a single operand with no destination, and a source that does not exist. All four match, including the quoting around the path. uutils 0.0.17 ships no install for Windows, so there is no TestRig here and WSL is the reference. Not implemented, and refused rather than faked: -s needs an external strip program, -g and -o need Windows account lookup, and --preserve-timestamps copies content but not the times, because V exposes no utime call.
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

Successfully merging this pull request may close these issues.

1 participant