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

ed: fix append bug #916

Merged
merged 1 commit into from
Jan 9, 2025
Merged

ed: fix append bug #916

merged 1 commit into from
Jan 9, 2025

Conversation

mknos
Copy link
Contributor

@mknos mknos commented Jan 8, 2025

  • It is valid usage to start ed with a filename that doesn't exist; ed is expected to start with an empty buffer and the default filename variable set
  • Today I found that commands 0i and 0a were resulting in the first line of input being lost
  • When debugging, I discovered the @lines list was empty when ed was started with a non-existent file
  • A placeholder item $lines[0] is expected to be populated, but edEdit() was returning early because the file doesn't exist
  • Fix this by initialising $lines[0] at start of program, i.e. before the 1st edEdit() call
%perl ed not-exist
not-exist: No such file or directory
a
 ONE
 TWO
.
wq
10

* It is valid usage to start ed with a filename that doesn't exist; ed is expected to start with an empty buffer and the default filename variable set
* Today I found that commands 0i and 0a were resulting in the first line of input being lost
* When debugging this I discovered lines-list was empty when ed was started with a file argument that doesn't exist
* A placeholder item $lines[0] is expected to be populated
* edEdit() was returning early because the file doesn't exist
* Fix this by initialising $lines[0] at start of program, i.e. before the 1st edEdit() call
@github-actions github-actions bot added Type: enhancement improve a feature that already exists Priority: low get to this whenever Program: ed The ed program labels Jan 8, 2025
@mknos mknos temporarily deployed to automated_testing January 8, 2025 04:55 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing January 8, 2025 04:55 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing January 8, 2025 04:55 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing January 8, 2025 04:55 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing January 8, 2025 04:55 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing January 8, 2025 04:55 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing January 8, 2025 04:55 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing January 8, 2025 04:55 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing January 8, 2025 04:55 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing January 8, 2025 04:55 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing January 8, 2025 04:55 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing January 8, 2025 04:55 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing January 8, 2025 04:55 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing January 8, 2025 04:55 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing January 8, 2025 04:55 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing January 8, 2025 04:55 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing January 8, 2025 04:55 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing January 8, 2025 04:55 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing January 8, 2025 04:55 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing January 8, 2025 04:55 — with GitHub Actions Inactive
@coveralls
Copy link

coveralls commented Jan 8, 2025

Pull Request Test Coverage Report for Build 12664325113

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.7%) to 73.389%

Totals Coverage Status
Change from base Build 12663127144: -0.7%
Covered Lines: 353
Relevant Lines: 481

💛 - Coveralls

@briandfoy briandfoy merged commit ce74886 into briandfoy:master Jan 9, 2025
21 of 23 checks passed
@briandfoy briandfoy self-assigned this Jan 9, 2025
@briandfoy briandfoy removed the Type: enhancement improve a feature that already exists label Jan 9, 2025
@briandfoy briandfoy added Type: bug an existing feature does not work Status: accepted The fix is accepted and removed Priority: low get to this whenever labels Jan 9, 2025
@briandfoy
Copy link
Owner

changes: initialize line placeholder so lines aren't lost after stating with an empty file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Program: ed The ed program Status: accepted The fix is accepted Type: bug an existing feature does not work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants