Page MenuHomeFreeBSD

Fix space handling in USES=dos2unix + DOS2UNIX_FILES
AcceptedPublic

Authored by AMDmi3 on Oct 19 2015, 3:10 PM.
Tags
None
Referenced Files
Unknown Object (File)
May 13 2024, 1:00 PM
Unknown Object (File)
Dec 26 2023, 3:55 PM
Unknown Object (File)
Nov 29 2023, 4:19 PM
Unknown Object (File)
Oct 5 2023, 8:17 AM
Unknown Object (File)
Jun 19 2023, 2:35 PM
Unknown Object (File)
May 20 2023, 10:38 PM
Unknown Object (File)
Apr 26 2023, 12:32 AM
Unknown Object (File)
Jan 16 2023, 10:04 PM
Subscribers

Details

Reviewers
mat
Group Reviewers
portmgr
Summary

When USES=dos2unix + DOS2UNIX_FILES is used, the list of files is passed to sed replacing command through extra echo, which makes it impossible to pass path with spaces (e.g. DOS2UNIX_FILES=foo\ bar\ baz/*.txt). Fix this by removing unneded echo

Test Plan

Tested on graphics/aoi with removed "AoI Manual" -> "AoI_Manual" directory rename

Diff Detail

Repository
rP FreeBSD ports repository
Lint
No Lint Coverage
Unit
No Test Coverage
Build Status
Buildable 815
Build 815: arc lint + arc unit

Event Timeline

AMDmi3 retitled this revision from to Fix space handling in USES=dos2unix + DOS2UNIX_FILES.
AMDmi3 updated this object.
AMDmi3 edited the test plan for this revision. (Show Details)

The echo|xargs is there to prevent ARG_MAX problems.

Though, maybe people should use globs in that case.

In D3936#81831, @mat wrote:

The echo|xargs is there to prevent ARG_MAX problems.

That was my first idea, then I though it was silly, as it will overflow echo's max number of arguments the same way it may overflow sed's. However after you've mentioned it I started to suspect that the difference is in that echo is a builtin. After some more though it's apparent that it nevertheless still sends whole expanded argument list to sed (e.g. there's no -n argument to xargs), so there's no real functional change.

However it game me an idea that we may iterate over ${DOS2UNIX_FILES} and call sed multiple times.

Also I remembered that I also wanted to move this whole code from if/elif/else to if/if/if, so user may use files, regex and glob at the same time. What do you think?

mat added a reviewer: mat.
This revision is now accepted and ready to land.Nov 9 2015, 2:40 PM