Subject area or topic
I do not know.
Page or pages affected
I have attempted to do as docs/blob/c266423cd1ffcc5841a558b5331ce1b3e66c4f50/src/content/docs/support-and-community/troubleshooting-and-support/sending-us-feedback.mdx?plain=1#L167 advises, verbatim.
What is incorrect, outdated, missing, or unclear?
However, it fails, in bash-5.3.0-2.fc43 and pwsh:
**********************
PowerShell transcript start
Start time: 20260501150646
Username: Beedell\RokeJulianLockhart
RunAs User: Beedell\RokeJulianLockhart
Configuration Name:
Machine: Beedell (Unix 6.19.14.200)
Host Application: /home/RokeJulianLockhart/.dotnet/tools/.store/powershell/7.5.4/powershell/7.5.4/tools/net9.0/any/unix/pwsh.dll
Process ID: 53560
PSVersion: 7.5.4
PSEdition: Core
GitCommitId: 7.5.4
OS: Fedora Linux 43 (KDE Plasma Desktop Edition)
Platform: Unix
PSCompatibleVersions: 1.0, 2.0, 3.0, 4.0, 5.0, 5.1, 6.0, 7.0
PSRemotingProtocolVersion: 2.3
SerializationVersion: 1.1.0.1
WSManStackVersion: 3.0
**********************
Transcript started, output file is /home/RokeJulianLockhart/PowerShell_transcript.Beedell.6rJXhcDx.20260501150646.txt
**********************
Command start time: 20260501150702
**********************
PS /home/RokeJulianLockhart> tar -czf $Home/warp_preview-logs.tar.gz -C $Home/.local/state/warp-terminal-preview warp_preview.log*
/usr/bin/tar: warp_preview.log*: Cannot stat: No such file or directory
/usr/bin/tar: warp_preview.log*: Cannot stat: No such file or directory
/usr/bin/tar: Exiting with failure status due to previous errors
/usr/bin/tar: Exiting with failure status due to previous errors
Suggested update
chatgpt.com/s/t_69f51f4814d881918d4eb77f5456bedb appears to accurately explain that the failure is due to shell glob expansion occurring before tar is invoked. Within the original command:
#!/usr/bin/env sh
tar -czf ~/warp_preview-logs.tar.gz -C ~/.local/state/warp-terminal-preview warp_preview.log*
…the pattern “warp_preview.log*” is expanded, by the shell, in one's pwd, rather than in $HOME/.local/state/warp-terminal-preview. If no files, matching that pattern, exist within the current directory, the glob remains unexpanded (depending on shell settings), so tar receives the literal string “warp_preview.log*”. It, then, searches, for that file, inside the -C directory, and fails, with:
Cannot stat: No such file or directory.
-C affects where tar looks for files, but it does not affect how the shell expands globs. To remediate this:
-
cd first, so that the shell correctly expands:
#!/usr/bin/env sh
cd $HOME/.local/state/warp-terminal-preview && \
tar -czf $HOME/warp_preview-logs.tar.gz warp_preview.log*
-
Allow tar to cope with the pattern, internally:
#!/usr/bin/env sh
tar -czf $HOME/warp_preview-logs.tar.gz \
-C $HOME/.local/state/warp-terminal-preview \
--wildcards 'warp_preview.log*'
If you want failure when no files match (rather than silent success), you can explicitly check:
#!/usr/bin/env sh
shopt -s nullglob
files=($HOME/.local/state/warp-terminal-preview/warp_preview.log*)
((${#files[@]})) || { echo "No matching logs"; exit 1; }
tar -czf $HOME/warp_preview-logs.tar.gz -C $HOME/.local/state/warp-terminal-preview "${files[@]##*/}"
To summarise, the glob is expanded in the wrong directory, because -C does not influence globbing.
Subject area or topic
I do not know.
Page or pages affected
I have attempted to do as
docs/blob/c266423cd1ffcc5841a558b5331ce1b3e66c4f50/src/content/docs/support-and-community/troubleshooting-and-support/sending-us-feedback.mdx?plain=1#L167advises, verbatim.What is incorrect, outdated, missing, or unclear?
However, it fails, in
bash-5.3.0-2.fc43andpwsh:Suggested update
chatgpt.com/s/t_69f51f4814d881918d4eb77f5456bedbappears to accurately explain that the failure is due to shell glob expansion occurring beforetaris invoked. Within the original command:…the pattern “
warp_preview.log*” is expanded, by the shell, in one'spwd, rather than in$HOME/.local/state/warp-terminal-preview. If no files, matching that pattern, exist within the current directory, the glob remains unexpanded (depending on shell settings), sotarreceives the literal string “warp_preview.log*”. It, then, searches, for that file, inside the-Cdirectory, and fails, with:-Caffects wheretarlooks for files, but it does not affect how the shell expands globs. To remediate this:cdfirst, so that the shell correctly expands:Allow
tarto cope with the pattern, internally:If you want failure when no files match (rather than silent success), you can explicitly check:
To summarise, the glob is expanded in the wrong directory, because
-Cdoes not influence globbing.