Skip to content

yes: use splice_data functions from uucore #6980

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

Closed
wants to merge 2 commits into from

Conversation

DaringCuteSeal
Copy link
Contributor

@DaringCuteSeal DaringCuteSeal commented Dec 19, 2024

Have yes use the splice-write utilities from uucore. Follow-up of #6964.

@@ -10,19 +10,21 @@
//! does not handle copying special files (e.g pipes, character/block devices).

use crate::error::{UError, UResult};
use nix::unistd;

use std::fs::File;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
use std::fs::File;

#[cfg(unix)]
use nix::unistd;
#[cfg(unix)]
use nix::{errno::Errno, libc::S_IFIFO, sys::stat::fstat};
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
use nix::{errno::Errno, libc::S_IFIFO, sys::stat::fstat};
use nix::{libc::S_IFIFO, sys::stat::fstat};

@DaringCuteSeal
Copy link
Contributor Author

eh, i figured out some missing compile guards on the buf-copy. lemme resolve em first and make a new PR

Copy link

GNU testsuite comparison:

GNU test failed: tests/misc/yes. tests/misc/yes is passing on 'main'. Maybe you have to rebase?
Skipping an intermittent issue tests/tail/inotify-dir-recreate (passes in this run but fails in the 'main' branch)

Copy link

GNU testsuite comparison:

GNU test failed: tests/misc/yes. tests/misc/yes is passing on 'main'. Maybe you have to rebase?
Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/tail/inotify-dir-recreate (passes in this run but fails in the 'main' branch)

@DaringCuteSeal DaringCuteSeal marked this pull request as ready for review December 29, 2024 03:30
Copy link

GNU testsuite comparison:

GNU test failed: tests/misc/yes. tests/misc/yes is passing on 'main'. Maybe you have to rebase?
Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)

@cakebaker
Copy link
Contributor

Did you see that some jobs in the CI fail?

@DaringCuteSeal
Copy link
Contributor Author

Did you see that some jobs in the CI fail?

oh, hmm i didn't see those. sorry, i'll try to fix em a bit later

@DaringCuteSeal DaringCuteSeal marked this pull request as draft January 2, 2025 06:04
Copy link

github-actions bot commented Jan 2, 2025

GNU testsuite comparison:

GNU test failed: tests/misc/yes. tests/misc/yes is passing on 'main'. Maybe you have to rebase?
Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)

@DaringCuteSeal
Copy link
Contributor Author

DaringCuteSeal commented Jan 2, 2025

Hi, ran into a problem here. >,<

I found out that yes actually needs to know the kind of error that the write function encountered, and if it is returning from a broken pipe, yes will return without any error which I think makes sense. I suspect this is why the tests on Windows are problematic.

The problem is that, yes cannot know the kind of error it gets as the functions it uses (from the buf-copy module I made for a refactor in #6964) because the functions all return a UResult (just a trait).

I'm actually considering deleting altogether the code I separated from yes in uucore, as I think the use case for those functions is pretty specific to yes anyways.

So, what do the devs here think? There are two choices I see:

  • Make several functions from buf-copy return std::io::Error. Not too elegant imo
  • Do not modify yes as its use of buffer-copying is too specific to be split into a module. Delete the functions I split from uucore/buf-copy.

Copy link

github-actions bot commented Jan 2, 2025

GNU testsuite comparison:

GNU test failed: tests/misc/yes. tests/misc/yes is passing on 'main'. Maybe you have to rebase?

@sylvestre
Copy link
Contributor

Do not modify yes as its use of buffer-copying is too specific to be split into a module. Delete the functions I split from uucore/buf-copy.

Let's do that, it is fine :)

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