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

od: incorrect file offsets after first 16 bytes #434

Merged
merged 1 commit into from
Jan 31, 2024

Conversation

mknos
Copy link
Contributor

@mknos mknos commented Jan 31, 2024

  • The file offsets incorrectly jumped from 0 to 17, instead of 0 to 16
  • When debugging this I found the formatting routines were modifying the value of $data by appending pad bytes
  • Fix offsets issue by not modifying the value of $data
  • Using global $len in the format routines is also not correct since the input loop was previously changed and $len will always be 1 (padding was added incorrectly in some cases)
  • Remove global variable $upformat and provide the unpack format directly to unpack()
  • Remove unsupported -a flag from the SYNOPSIS; it was not mentioned in help()

* I observed the file offsets incorrectly jumped from 0 to 17, instead of 0 to 16
* When debugging this I discovered the formatting routines were modifying the value of $data by appending pad bytes
* Fix offsets issue by not modifying the value of $data
* Using global $len in the format routines is also not correct since the input loop was previously changed and $len will always be 1
* Remove global variable $upformat and provide the unpack format directly to unpack()
* Remove unsupported -a flag from the SYNOPSIS
@github-actions github-actions bot added Type: enhancement improve a feature that already exists Priority: low get to this whenever Program: od The od program labels Jan 31, 2024
@briandfoy briandfoy merged commit 88da86b into briandfoy:master Jan 31, 2024
1 of 2 checks passed
@briandfoy
Copy link
Owner

This fails the tests for od since the output has changed, but I'll fix those.

briandfoy added a commit that referenced this pull request Jan 31, 2024
@briandfoy briandfoy self-assigned this Jan 31, 2024
@briandfoy briandfoy added Status: accepted The fix is accepted and removed Priority: low get to this whenever labels Jan 31, 2024
@briandfoy
Copy link
Owner

changes: fix offset numbering

@briandfoy briandfoy added Status: released there is a new release with this fix and removed Status: accepted The fix is accepted labels Mar 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Program: od The od program Status: released there is a new release with this fix Type: enhancement improve a feature that already exists
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants