pkg.sh: Fix chown and chmod lines in generated postinst #157

Merged
Jan Lindemann merged 1 commit from jan/fix/20261027-pkg-sh-fix-chown-and-chmod-lines-in-generated-postinst into master 2026-10-27 07:12:52 +01:00 AGit
Owner

pkg.sh: Fix chown and chmod lines in generated postinst

The postinst generator looks up the install log line of each file with a regex grep on the file path, and the dots of the path match any character. When the grep returns several lines, milk_install_log_spec_attr() passes the extra lines through, so the emitted chown and chmod commands split across lines, dpkg -i reports errors for the fragments, and the owner and mode of the file are not applied.

Match the end of the log line against the file path literally and take the first match. The install log line ends in the file path, but may carry a build prefix before it, so the literal comparison of the tail of the line selects exactly the line of the file, for plain and %config entries alike.

#### pkg.sh: Fix chown and chmod lines in generated postinst The postinst generator looks up the install log line of each file with a regex grep on the file path, and the dots of the path match any character. When the grep returns several lines, `milk_install_log_spec_attr()` passes the extra lines through, so the emitted chown and chmod commands split across lines, dpkg -i reports errors for the fragments, and the owner and mode of the file are not applied. Match the end of the log line against the file path literally and take the first match. The install log line ends in the file path, but may carry a build prefix before it, so the literal comparison of the tail of the line selects exactly the line of the file, for plain and %config entries alike.
pkg.sh: Fix chown and chmod lines in generated postinst
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 4m57s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 5m11s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 4m34s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 4m48s
CI / Packaging test (push) Successful in 0s
97cc7fbecd
The postinst generator looks up the install log line of each file with a
regex grep on the file path, and the dots of the path match any character.
When the grep returns several lines, milk_install_log_spec_attr() passes
the extra lines through, so the emitted chown and chmod commands split
across lines, dpkg -i reports errors for the fragments, and the owner and
mode of the file are not applied.

Match the end of the log line against the file path literally and take the
first match. The install log line ends in the file path, but may carry a
build prefix before it, so the literal comparison of the tail of the line
selects exactly the line of the file, for plain and %config entries alike.

Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v1.4.0
Signed-off-by: Jan Lindemann <jan@janware.com>
Jan Lindemann scheduled this pull request to auto merge when all checks succeed 2026-10-27 07:02:40 +01:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
janware/jw-pkg!157
No description provided.