rmyorston / busybox-w32

WIN32 native port of BusyBox.
https://frippery.org/busybox
Other
670 stars 124 forks source link

Directory */ glob not working in shell script #381

Closed otpfiste closed 7 months ago

otpfiste commented 7 months ago

Hi,

a simple script like the following should only return folders, but it returns also regular files. I tested it in a busybox under Ubuntu, and there it works correctly.

#!/bin/sh
for folder in */
do
    printf '%s\n' "$folder"
done

All the best, Oliver

rmyorston commented 7 months ago

Which version of busybox-32 are you using? (busybox | head -1)

I'm unable to reproduce the problem in the current release.

otpfiste commented 7 months ago

I use: BusyBox v1.37.0-FRP-5236-g7dff7f376 (2023-12-06 10:31:32 GMT)

I made some more test and found out that the problem only happens when running the script in a NAS network share mounted as a drive.

rmyorston commented 7 months ago

Thanks for the additional information. This allowed me to reproduce the problem and track down the cause.

It turns out the WIN32 API being used to detect that files weren't directories works differently on a network share than on an actual disk.

The issue should be fixed in the latest prerelease binaries. (PRE-5254 or above)

otpfiste commented 7 months ago

Hi,

I tested it, it works great, many thanks for the fast fix!!

All the best