mingw_sdk_handle_symlink.bbclass: avoid using non-posix -d option for read
PATCH 1/1 mingw_sdk_handle_symlink.bbclass: avoid using non-posix -d option for read
From: Chen Qi <[email protected]>
The '-d' option for read is bash specific extension. We need to avoid using it.
--- classes/mingw_sdk_handle_symlink.bbclass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
classes/mingw_sdk_handle_symlink.bbclass +1 -1
@@ -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
Signature · 1 line
2.43.0
Quoted 16 lines · On Thu, Jan 15, 2026 at 10:05 PM <[email protected]> wrote:
From: Chen Qi <[email protected]>
The '-d' option for read is bash specific extension. We need to avoid using it.
Signed-off-by Chen Qi <[email protected]>--- classes/mingw_sdk_handle_symlink.bbclass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)classes/mingw_sdk_handle_symlink.bbclass +0
-0
classes/mingw_sdk_handle_symlink.bbclass WINSDK_NO_SYMLINK ?= "0" · line 6
Quoted 5 lines
classes/mingw_sdk_handle_symlink.bbclass +1
-1@@ -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?
Quoted 6 lines
classes/mingw_sdk_handle_symlink.bbclass +0
-1target=$(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 <[email protected]>
Sent: Saturday, January 17, 2026 12:30 AM
To: Chen, Qi <[email protected]>
Cc: [email protected]
Subject: Re: [meta-mingw][PATCH] mingw_sdk_handle_symlink.bbclass: avoid using non-posix -d option for read
Quoted 17 lines · On Thu, Jan 15, 2026 at 10:05 PM <[email protected]> wrote:
From: Chen Qi <[email protected]>
The '-d' option for read is bash specific extension. We need to avoid using it.
Signed-off-by Chen Qi <[email protected]>--- classes/mingw_sdk_handle_symlink.bbclass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)classes/mingw_sdk_handle_symlink.bbclass +0
-0
classes/mingw_sdk_handle_symlink.bbclass WINSDK_NO_SYMLINK ?= "0" · line 7
Quoted 6 lines
classes/mingw_sdk_handle_symlink.bbclass +2
-1@@ -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?
Quoted 6 lines
classes/mingw_sdk_handle_symlink.bbclass +0
-1target=$(readlink -f "$symlink" || echo "NOTVALID") if [ "$target" = "NOTVALID" ]; then continue --2.43.0