-
-
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
dd: allow skipping and seeking in FIFOs #4164
Conversation
GNU testsuite comparison:
|
Well, there's a few platform-compatibility issues I'll need to work out, but this is good news:
|
GNU testsuite comparison:
|
3 similar comments
GNU testsuite comparison:
|
GNU testsuite comparison:
|
GNU testsuite comparison:
|
a389752
to
058d2c2
Compare
GNU testsuite comparison:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love where this is going!
Looks like something is not working right on macos:
What do you think about just skipping those two tests on macos and opening a new issue requesting an implementation that works on macos? I don't have a Mac computer so it's hard for me to debug these issues. |
GNU testsuite comparison:
|
.succeeds() | ||
.stderr_only("0+0 records in\n0+0 records out\n"); | ||
|
||
let output = child.wait_with_output().unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If pull request #4136 gets merged, that would allow me to make these tests more concise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That PR is now merged, do you still want to do this in this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I was wrong when I made this comment. The child
process comes from Command
, not UCommand
, so I don't think any changes can be made here at the moment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could use ts.cmd("dd")
to make it a UCommand
(which will still call the system dd
, not uutils), but it's not a high priority.
I tried getting the macos build to succeed using @tertsdiepraam's suggestion, but it doesn't seem to work. |
7838177
to
641a49c
Compare
GNU testsuite comparison:
|
db0ef95
to
d121c76
Compare
GNU testsuite comparison:
|
d121c76
to
52b6ac0
Compare
GNU testsuite comparison:
|
52b6ac0
to
ba95ef4
Compare
GNU testsuite comparison:
|
GNU testsuite comparison:
|
ec77151
to
c09dbb1
Compare
GNU testsuite comparison:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the dd_out
should also just become a free function dd
, but that's not high priority. This cleans up so much already.
.succeeds() | ||
.stderr_only("0+0 records in\n0+0 records out\n"); | ||
|
||
let output = child.wait_with_output().unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That PR is now merged, do you still want to do this in this PR?
Great minds think alike; I have such a branch on my local machine but it depends on this branch, so I was waiting until this is merged. |
c09dbb1
to
568a225
Compare
GNU testsuite comparison:
|
I skipped the tests for this feature on macos and freebsd because I wasn't sure how to make the implementation work. |
This mirrors a recent commit that introduced the `Dest` enum and a simplified `Output` struct. These changes allow us to add new types of inputs and output more easily.
For example, `dd seek=1 of=fifo` will now work.
For example, `dd skip=1 if=fifo` will now work.
568a225
to
c52647a
Compare
GNU testsuite comparison:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent! Just one nit
if settings.skip > 0 { | ||
src.skip(settings.skip)?; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to extract this? It appears in all the new_*
functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean to factor these three lines out of the new_*
functions into a new helper function and call that function in each of the three places? If so, I don't think it offers much benefit but I can do that if you it seems better to you.
Or do you mean to move this functionality out to the calling code so that it appears after the call to new_*()
? I think I tried a design like that when I was first working on this pull request, but I no longer remember if it worked :).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or do you mean to move this functionality out to the calling code so that it appears after the call to new_*()?
I meant this one, but it's not that important. Let's just merge this :)
First, this pull request creates a
Source
enum and simplifies theInput
struct indd
, mirroring pull request #4134 that introduced theDest
enum and a simplifiedOutput
struct. Second, this pull request adds support seeking in FIFOs given as either input or output (or both). For example,dd seek=1 of=fifo
anddd skip=1 if=fifo
will now work.This should cause GNU test suite file
tests/dd/no-allocate.sh
to change fromERROR
toFAIL
status.Fixes #3321.