Skip to content

Conversation

@vszakats
Copy link
Member

@vszakats vszakats commented Nov 4, 2025

Fixes this error in environments missing /dev/stderr:

wcurl: line 88: can't create /dev/stderr: nonexistent directory

Seen on Windows with busybox.exe:
https://frippery.org/busybox/

When I tried wcurl on Windows using busybox [1], it failed with:
```
wcurl: line 88: can't create /dev/stderr: nonexistent directory
```

[1] https://frippery.org/busybox/
@vszakats
Copy link
Member Author

vszakats commented Nov 4, 2025

How to run wcurl on Windows:

  1. Assume a curl.exe in PATH.

  2. download busybox.exe from: https://frippery.org/files/busybox/busybox.exe (or another
    variant, e.g. for ARM64 or
    64-bit Intel Unicode)

  3. Create a wcurl.bat file with this content, in the same directory as the busybox .exe:

@"%~dp0busybox.exe" sh "%~dp0wcurl" %*
  1. Try it:
wcurl curl.se/download/curl-8.16.0.zip
  1. Add the directory holding both wcurl.bat and busybox to PATH.

@vszakats vszakats changed the title replace /dev/stderr with >&2 for portability replace > /dev/stderr with >&2 for portability Nov 4, 2025
@vszakats vszakats changed the title replace > /dev/stderr with >&2 for portability replace >/dev/stderr with >&2 for portability Nov 4, 2025
@vszakats
Copy link
Member Author

vszakats commented Nov 4, 2025

wcurl.bat downloading busybox automatically, if necessary:

@set bb_dir=%~dp0
@set bb_exe=busybox.exe
@if "%PROCESSOR_ARCHITECTURE%" == "AMD64" set bb_exe=busybox64u.exe
@if "%PROCESSOR_ARCHITECTURE%" == "ARM64" set bb_exe=busybox64a.exe
@for %%P in (%PATH:;=;%) do @dir /b "%%~P\busybox.exe" >nul 2>&1 && (set bb_dir=%%~P\& set bb_exe=busybox.exe)
@if not exist "%bb_dir%%bb_exe%" curl -fsSO https://frippery.org/files/busybox/%bb_exe%
@"%bb_dir%%bb_exe%" sh "%~dp0wcurl" %*

Copy link
Collaborator

@sergiodj sergiodj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. This is an old habit of mine (using /dev/stderr instead of >&2), which while still being considered POSIX compliant, isn't universally portable as you found out.

LGTM.

@sergiodj sergiodj merged commit 376b405 into curl:main Nov 5, 2025
4 checks passed
@vszakats vszakats deleted the stderr branch November 5, 2025 01:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants