diff options
| author | Craig Jennings <c@cjennings.net> | 2026-08-03 15:27:17 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-08-03 15:27:17 -0500 |
| commit | 6f90ec5b660c6a2552ac7284a3d9d963771fbbc2 (patch) | |
| tree | 90bcdaafd27fabdd7dfcee7484b8646e2bc6923b /tests/test-custom-text-enclose--region-or-buffer-bounds.el | |
| parent | a457ade9207be48f6bfaa519046d7acea390ff1b (diff) | |
| download | dotemacs-6f90ec5b660c6a2552ac7284a3d9d963771fbbc2.tar.gz dotemacs-6f90ec5b660c6a2552ac7284a3d9d963771fbbc2.zip | |
fix(music): size a playlist by its content, not by its symlink
cj/music--append-track-to-m3u-file decided whether to prepend a newline by
seeking to a byte offset from file-attributes, which doesn't follow
symlinks. On a stow-deployed playlist that measures the link string instead
of the file.
Two failure modes, and I only went looking for the second. All 100 symlinked
playlists read the wrong byte, so a file already ending in a newline looked
unterminated and gained a blank line on every append. On the 31 whose link
string is longer than their content the range fell outside the file
entirely. Nothing was inserted, and char-after handed nil to a numeric
comparison, so the append died with a wrong-type error.
The probe now reads the file and checks its last character. That takes
file-attributes out of the path, so this class can't come back. The largest
real playlist is 11 KB and the read costs 0.11 ms, so being clever about
offsets bought nothing.
A test per mode, because one fixture can't show both. Seed the blank-line
case with content shorter than the link string and it lands on the error
path instead, going red for the wrong reason and proving nothing.
The cheap patch was guarding char-after against nil. That would have
silenced the crash on 31 playlists and left the blank line live on all 100.
Diffstat (limited to 'tests/test-custom-text-enclose--region-or-buffer-bounds.el')
0 files changed, 0 insertions, 0 deletions
