| Message ID | 20260116050512.3751871-1-Qi.Chen@windriver.com |
|---|---|
| State | New |
| Headers | show |
| Series | [meta-mingw] mingw_sdk_handle_symlink.bbclass: avoid using non-posix -d option for read | expand |
On Thu, Jan 15, 2026 at 10:05 PM <Qi.Chen@windriver.com> wrote: > > From: Chen Qi <Qi.Chen@windriver.com> > > The '-d' option for read is bash specific extension. We need to > avoid using it. > > Signed-off-by: Chen Qi <Qi.Chen@windriver.com> > --- > classes/mingw_sdk_handle_symlink.bbclass | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/classes/mingw_sdk_handle_symlink.bbclass b/classes/mingw_sdk_handle_symlink.bbclass > index 2f6dbe6..e158d14 100644 > --- a/classes/mingw_sdk_handle_symlink.bbclass > +++ b/classes/mingw_sdk_handle_symlink.bbclass > @@ -3,7 +3,7 @@ WINSDK_NO_SYMLINK ?= "0" > archive_sdk:prepend:sdkmingw32 () { > if [ "${WINSDK_NO_SYMLINK}" = "1" ]; then > for parse_type in "file" "directory"; do > - find "${SDK_OUTPUT}/${SDKPATH}" -type l -print0 | while IFS= read -r -d '' symlink; do > + find "${SDK_OUTPUT}/${SDKPATH}" -type l -print | while read -r symlink; do This would now break on file names with spaces in them; As much as I would like to say "don't do that", is there some we we can preserve the behavior of using -print0 to allow that to keep working? > target=$(readlink -f "$symlink" || echo "NOTVALID") > if [ "$target" = "NOTVALID" ]; then > continue > -- > 2.43.0 >
Hi Joshua, I had the same concern with you, so I used '-print0' without doing more test. My instinct was that space is used as the separator by default. But when I fixed this '-d' issue, I tested it. The 'read' command can handle the space by default. It actually uses newline as the separator by default. Below is an example: $ find . . ./dir_without_space ./dir_without_space/file2 with space ./dir_without_space/file2_without_space ./dir with space ./dir with space/file with space ./dir with space/file_without_space $ find . | while read -r var; do echo "var: $var"; done var: . var: ./dir_without_space var: ./dir_without_space/file2 with space var: ./dir_without_space/file2_without_space var: ./dir with space var: ./dir with space/file with space var: ./dir with space/file_without_space Regards, Qi -----Original Message----- From: Joshua Watt <jpewhacker@gmail.com> Sent: Saturday, January 17, 2026 12:30 AM To: Chen, Qi <Qi.Chen@windriver.com> Cc: yocto-patches@lists.yoctoproject.org Subject: Re: [meta-mingw][PATCH] mingw_sdk_handle_symlink.bbclass: avoid using non-posix -d option for read On Thu, Jan 15, 2026 at 10:05 PM <Qi.Chen@windriver.com> wrote: > > From: Chen Qi <Qi.Chen@windriver.com> > > The '-d' option for read is bash specific extension. We need to avoid > using it. > > Signed-off-by: Chen Qi <Qi.Chen@windriver.com> > --- > classes/mingw_sdk_handle_symlink.bbclass | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/classes/mingw_sdk_handle_symlink.bbclass > b/classes/mingw_sdk_handle_symlink.bbclass > index 2f6dbe6..e158d14 100644 > --- a/classes/mingw_sdk_handle_symlink.bbclass > +++ b/classes/mingw_sdk_handle_symlink.bbclass > @@ -3,7 +3,7 @@ WINSDK_NO_SYMLINK ?= "0" > archive_sdk:prepend:sdkmingw32 () { > if [ "${WINSDK_NO_SYMLINK}" = "1" ]; then > for parse_type in "file" "directory"; do > - find "${SDK_OUTPUT}/${SDKPATH}" -type l -print0 | while IFS= read -r -d '' symlink; do > + find "${SDK_OUTPUT}/${SDKPATH}" -type l -print > + | while read -r symlink; do This would now break on file names with spaces in them; As much as I would like to say "don't do that", is there some we we can preserve the behavior of using -print0 to allow that to keep working? > target=$(readlink -f "$symlink" || echo "NOTVALID") > if [ "$target" = "NOTVALID" ]; then > continue > -- > 2.43.0 >
diff --git a/classes/mingw_sdk_handle_symlink.bbclass b/classes/mingw_sdk_handle_symlink.bbclass index 2f6dbe6..e158d14 100644 --- a/classes/mingw_sdk_handle_symlink.bbclass +++ b/classes/mingw_sdk_handle_symlink.bbclass @@ -3,7 +3,7 @@ WINSDK_NO_SYMLINK ?= "0" archive_sdk:prepend:sdkmingw32 () { if [ "${WINSDK_NO_SYMLINK}" = "1" ]; then for parse_type in "file" "directory"; do - find "${SDK_OUTPUT}/${SDKPATH}" -type l -print0 | while IFS= read -r -d '' symlink; do + find "${SDK_OUTPUT}/${SDKPATH}" -type l -print | while read -r symlink; do target=$(readlink -f "$symlink" || echo "NOTVALID") if [ "$target" = "NOTVALID" ]; then continue