Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

tail: show end of device#8037

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
cakebaker merged 1 commit intouutils:mainfrommartinkunkel2:main
Jul 17, 2025
Merged

tail: show end of device#8037

cakebaker merged 1 commit intouutils:mainfrommartinkunkel2:main
Jul 17, 2025

Conversation

martinkunkel2
Copy link
Contributor

@martinkunkel2martinkunkel2 commentedMay 30, 2025
edited
Loading

gnu coreutils will show end of device for block devices. In current implementation this is skipped as a block devices are recognized as untailable.

The change ensures that we first try to output the end of any file and only then tell the observer that the file is not observable.

Gnu coreutils:

$ tail -c 16 /dev/sdc tail: cannot open '/dev/sdc' for reading: Permission denied$ sudo tail -c 16 /dev/sdc |hexdump0000000 d566 3260 cee2 32e5 7ce3 50ee 49c7 81e00000010

Before change:

$ target/debug/coreutils tail -c 16 /dev/sdc $ sudo target/debug/coreutils tail -c 16 /dev/sdc | hexdump

After change:

$ target/debug/coreutils tail -c 16 /dev/sdc tail: cannot open '/dev/sdc' for reading: Permission denied$ sudo target/debug/coreutils tail -c 16 /dev/sdc | hexdump0000000 d566 3260 cee2 32e5 7ce3 50ee 49c7 81e00000010

@github-actionsGitHub Actions
Copy link

GNU testsuite comparison:

GNU test failed: tests/df/df-output. tests/df/df-output is passing on 'main'. Maybe you have to rebase?GNU test failed: tests/sort/sort-stale-thread-mem. tests/sort/sort-stale-thread-mem is passing on 'main'. Maybe you have to rebase?GNU test failed: tests/tail/tail-sysfs. tests/tail/tail-sysfs is passing on 'main'. Maybe you have to rebase?Skipping an intermittent issue tests/misc/tee (passes in this run but fails in the 'main' branch)Congrats! The gnu test tests/tail/end-of-device is no longer failing!

@martinkunkel2martinkunkel2force-pushed themain branch 2 times, most recently from3770c88 to1bab7baCompareMay 30, 2025 20:26
@github-actionsGitHub Actions
Copy link

GNU testsuite comparison:

GNU test failed: tests/du/8gb. tests/du/8gb is passing on 'main'. Maybe you have to rebase?GNU test failed: tests/sort/sort-stale-thread-mem. tests/sort/sort-stale-thread-mem is passing on 'main'. Maybe you have to rebase?Skip an intermittent issue tests/misc/stdbuf (fails in this run but passes in the 'main' branch)Congrats! The gnu test tests/tail/end-of-device is no longer failing!Note: The gnu test tests/du/2g is now being skipped but was previously passing.

@github-actionsGitHub Actions
Copy link

GNU testsuite comparison:

GNU test failed: tests/sort/sort-stale-thread-mem. tests/sort/sort-stale-thread-mem is passing on 'main'. Maybe you have to rebase?Skipping an intermittent issue tests/misc/tee (passes in this run but fails in the 'main' branch)Congrats! The gnu test tests/tail/end-of-device is no longer failing!Note: The gnu test tests/du/2g is now being skipped but was previously passing.

@github-actionsGitHub Actions
Copy link

GNU testsuite comparison:

GNU test failed: tests/cp/same-file. tests/cp/same-file is passing on 'main'. Maybe you have to rebase?GNU test failed: tests/cp/sparse. tests/cp/sparse is passing on 'main'. Maybe you have to rebase?GNU test failed: tests/cp/sparse-to-pipe. tests/cp/sparse-to-pipe is passing on 'main'. Maybe you have to rebase?GNU test failed: tests/sort/sort-stale-thread-mem. tests/sort/sort-stale-thread-mem is passing on 'main'. Maybe you have to rebase?GNU test failed: tests/tail/truncate. tests/tail/truncate is passing on 'main'. Maybe you have to rebase?Skipping an intermittent issue tests/misc/tee (passes in this run but fails 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/end-of-device is no longer failing!

@bvinc
Copy link
Contributor

Sorry, but you need to rebase again.

I think after this rebase, you will no longer need to change the if statement that chooses betweenunbounded_tail andbounded_tail.

I am in full support of moving theis_tailable check down toobserver.add_path. I came to this same conclusion myself.

And if anyone asks for a unit test: I'm not sure how you would test tailing a block device. This is currently a root-only test in the GNU coreutils. The GNU test finds a mounted block device and tails it, which is generally something that only root can do.

gnu coreutils will show end of device for block devices.In current implementation this is skipped as a block devicesare recognized as untailable.The change ensures that we first try to output the end of anyfile and only then tell the observer that the file is notobservable.
@martinkunkel2
Copy link
ContributorAuthor

Sorry, but you need to rebase again.

I think after this rebase, you will no longer need to change the if statement that chooses betweenunbounded_tail andbounded_tail.

I am in full support of moving theis_tailable check down toobserver.add_path. I came to this same conclusion myself.

And if anyone asks for a unit test: I'm not sure how you would test tailing a block device. This is currently a root-only test in the GNU coreutils. The GNU test finds a mounted block device and tails it, which is generally something that only root can do.

Thank you for the updates. I rebased and can confirm: the if statement is not required anymore.

@martinkunkel2martinkunkel2 marked this pull request as ready for reviewJuly 16, 2025 17:00
@github-actionsGitHub Actions
Copy link

GNU testsuite comparison:

Congrats! The gnu test tests/tail/end-of-device is no longer failing!

@martinkunkel2martinkunkel2force-pushed themain branch 2 times, most recently fromfacc7c5 to24a556bCompareJuly 16, 2025 20:45
@martinkunkel2
Copy link
ContributorAuthor

I tried to add a test, seefacc7c5.

But the test is not very portable, e.g. on SELinux CI job, this happens:

tail: cannot open 'tmpfs' for reading: No such file or directory

I think a test is somehow pointless here. We would need to accept almost any failure as "ok".

@martinkunkel2
Copy link
ContributorAuthor

This PR is ready from my side. Please review.

@github-actionsGitHub Actions
Copy link

GNU testsuite comparison:

Congrats! The gnu test tests/tail/end-of-device is no longer failing!

@cakebakercakebaker merged commit213389c intouutils:mainJul 17, 2025
190 of 192 checks passed
@cakebaker
Copy link
Contributor

Congrats! The gnu test tests/tail/end-of-device is no longer failing!

Kudos and thanks!

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

tail compatibility: tail does not output end of device
3 participants
@martinkunkel2@bvinc@cakebaker

[8]ページ先頭

©2009-2025 Movatter.jp