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

tac fails to read a file #258

Merged
merged 1 commit into from
Sep 23, 2023
Merged

tac fails to read a file #258

merged 1 commit into from
Sep 23, 2023

Conversation

mknos
Copy link
Contributor

@mknos mknos commented Sep 23, 2023

  • tac successfully reads from stdin when run with no file argument
  • GNU tac accepts file argument of '-' for stdin but ppt version does not
  • I get an error when reading from a file: perl tac tac

Bad read on [ARRAY(0x1a04270)]: at tac line 197.
IO::Tac::get_lines(IO::Tac=GLOB(0x19ef4b8)) called at tac line 150
IO::Tac::READLINE(IO::Tac=GLOB(0x19ef4b8)) called at tac line 43

  • When debugging this I found that $tell is set to zero, then in the tell() perldoc manual it explains that tell() doesn't work with sysopen()
  • Calling sysread with size of zero was invalid
  • Replacing tell() with sysseek() call fixes the problem on my system

* tac reads from stdin when run with no file argument
* GNU tac accepts file argument of '-' for stdin but ppt version does not
* I get an array error when reading from a file: perl tac tac

Bad read on [ARRAY(0x1a04270)]:  at tac line 197.
	IO::Tac::get_lines(IO::Tac=GLOB(0x19ef4b8)) called at tac line 150
	IO::Tac::READLINE(IO::Tac=GLOB(0x19ef4b8)) called at tac line 43

* When debugging this I found that $tell is set to zero, then in the tell()
 perldoc manual it explains that tell() doesn't work with sysopen()
* Replacing tell() with sysseek() call fixes the problem on my system
@briandfoy briandfoy self-assigned this Sep 23, 2023
@briandfoy briandfoy added Type: bug an existing feature does not work Priority: low get to this whenever Program: tac The tac program labels Sep 23, 2023
Copy link
Owner

@briandfoy briandfoy left a comment

Choose a reason for hiding this comment

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

Good find!

@briandfoy briandfoy merged commit 45cb750 into briandfoy:master Sep 23, 2023
1 check passed
@briandfoy briandfoy added Status: accepted The fix is accepted and removed Priority: low get to this whenever labels Sep 23, 2023
@briandfoy briandfoy added Status: released there is a new release with this fix and removed Status: accepted The fix is accepted labels Oct 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Program: tac The tac program Status: released there is a new release with this fix Type: bug an existing feature does not work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants