Skip to content

Conversation

@bvinc
Copy link
Contributor

@bvinc bvinc commented Jul 4, 2025

This fixes a bug where tail would run forever when tailing /dev/zero. This behavior matches GNU tail.

@github-actions
Copy link

github-actions bot commented Jul 5, 2025

GNU testsuite comparison:

Skip an intermittent issue tests/misc/tee (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/misc/usage_vs_getopt (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/timeout/timeout (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/tail/tail-c is no longer failing!

use std::collections::HashMap;
use std::fs::File;
use std::io::{self, BufReader, BufWriter, ErrorKind, Read, Seek, SeekFrom, Write, stdin, stdout};
use std::os::unix::fs::MetadataExt;
Copy link
Contributor

Choose a reason for hiding this comment

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

You have to use a #[cfg] attribute as this line doesn't work on Windows.

Suggested change
use std::os::unix::fs::MetadataExt;
#[cfg(unix)]
use std::os::unix::fs::MetadataExt;

@bvinc
Copy link
Contributor Author

bvinc commented Jul 6, 2025

Thank you for all of the feedback, I believe I have addressed them all. The file size versus blocksize check is now very similar to what is in head.rs, which seems to be more fleshed out. It will work on Windows now. The renaming of metadata to st was also done to be more consistent with head.rs. If you would like me to keep it as metadata, I'm fine with that as well.

@github-actions
Copy link

github-actions bot commented Jul 6, 2025

GNU testsuite comparison:

Congrats! The gnu test tests/tail/tail-c is no longer failing!

@RenjiSann
Copy link
Collaborator

I believe I have addressed them all

I think there was a problem with your force push because there is no change (cf the diff)

@bvinc
Copy link
Contributor Author

bvinc commented Jul 6, 2025

You're right. I've pushed again.

This fixes a bug where tail would run forever when tailing
/dev/zero.  This behavior matches GNU tail.
@bvinc
Copy link
Contributor Author

bvinc commented Jul 6, 2025

Ah I didn't realize that tail had its own crate and Cargo.toml. I've updated the uucore dependency to include the "fs" feature.

@github-actions
Copy link

github-actions bot commented Jul 6, 2025

GNU testsuite comparison:

Skip an intermittent issue tests/misc/tee (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)
Congrats! The gnu test tests/tail/tail-c is no longer failing!

@github-actions
Copy link

github-actions bot commented Jul 7, 2025

GNU testsuite comparison:

Skip an intermittent issue tests/misc/stdbuf (fails in this run but passes in the 'main' branch)
Congrats! The gnu test tests/tail/tail-c is no longer failing!

@cakebaker cakebaker merged commit b9a790b into uutils:main Jul 7, 2025
76 checks passed
@cakebaker
Copy link
Contributor

Congrats! The gnu test tests/tail/tail-c is no longer failing!

Kudos, and thanks for your PR!

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.

4 participants