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

mktemp: combine --tmpdir and subdirectory info #3568

Merged
merged 1 commit into from
Jun 5, 2022

Conversation

jfinkels
Copy link
Collaborator

Combine the directory given in --tmpdir with any subdirectory
structure appearing in the prefix of the template string. For example,

$ mktemp --tmpdir=a b/cXXX
a/b/cNqJ

Previously, this would have incorrectly exited with an error message.

@jfinkels jfinkels force-pushed the mktemp-tmpdir-subdirectory branch from 7b601df to 806d259 Compare May 27, 2022 01:26
Copy link
Member

@tertsdiepraam tertsdiepraam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I was just gonna suggest we should implement this based on your other PR :) Great work!

src/uu/mktemp/src/mktemp.rs Outdated Show resolved Hide resolved
@jfinkels jfinkels force-pushed the mktemp-tmpdir-subdirectory branch from 806d259 to 6d2dc10 Compare May 28, 2022 02:41
@jfinkels
Copy link
Collaborator Author

After adding a test case for the situation suggested by @tertsdiepraam, I ran into a difficulty with producing the correct error messages due to how the prefix and suffix are computed. I'm going to put this back into draft status for now while I try to streamline the prefix and suffix handling code.

@jfinkels jfinkels marked this pull request as draft May 28, 2022 14:01
Add a unit test for combining the directory given in `--tmpdir` with
any subdirectory structure appearing in the prefix of the template
string. For example,

    $ mktemp --tmpdir=a b/cXXX
    a/b/cNqJ

This behavior is currently working, but a unit test was missing.
@jfinkels jfinkels force-pushed the mktemp-tmpdir-subdirectory branch from 6d2dc10 to a9e008f Compare June 1, 2022 22:22
@jfinkels jfinkels marked this pull request as ready for review June 1, 2022 22:22
@jfinkels
Copy link
Collaborator Author

jfinkels commented Jun 1, 2022

After rebasing on the main branch, which now includes the changes from pull request #3573, the issue I was originally trying to fix with this pull request is solved. I have updated this branch to just add a new unit test to protect against future regressions.

@sylvestre sylvestre merged commit 69c2871 into uutils:main Jun 5, 2022
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.

3 participants