Conversation
ossilator
suggested changes
Sep 18, 2026
tuffnatty
force-pushed
the
fish-send-reports-errors
branch
2 times, most recently
from
September 18, 2026 11:20
1d389fa to
69dff25
Compare
5 tasks
tuffnatty
force-pushed
the
fish-send-reports-errors
branch
from
September 18, 2026 11:30
69dff25 to
c9a1d95
Compare
Contributor
Author
|
I've applied @ossilator 's suggestions and rebased the PR on master to ease reviewing. |
tuffnatty
force-pushed
the
fish-send-reports-errors
branch
2 times, most recently
from
September 18, 2026 13:27
38190ed to
5c2bd0d
Compare
3 tasks
mc-worker
reviewed
Sep 18, 2026
Signed-off-by: Phil Krylov <phil@krylov.eu>
…pend scripts Signed-off-by: Phil Krylov <phil@krylov.eu>
Signed-off-by: Phil Krylov <phil@krylov.eu>
…L status Signed-off-by: Phil Krylov <phil@krylov.eu>
tuffnatty
force-pushed
the
fish-send-reports-errors
branch
from
September 18, 2026 16:47
5c2bd0d to
b03acfb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed changes
I've hit #3128 and tried to fix it.
The old workflow during moving a file to a write-protected remote location looked like:
copy_file_file()callsmc_open()on the destination vpath.mc_open()callsshell_open()shell_open()generates a directory entry in the local VFS cache and returns a handle to it.copy_file_file()transfers the file content into the local temporary copy and setsdst_statustoDEST_FULL.copy_file_file()callsmc_close().mc_close()callsshell_file_store().shell_file_store()calls remote script,src/vfs/shell/helpers/send.sendanswers with### 001.shell_file_store()receives### 001and starts to send file data.sendfails to truncate the destination file with> "${FILENAME}", ignores the error, and starts the loop to consume exactly the specified number of bytes, attempting to write them to the write-protected destination path and ignoring any errors.sendanswers with### 200.mc_close()returns successfully.copy_file_file()tries to chmod and chown the file, fails, the user chooses to Ignore the errors.copy_file_file()returnsFILE_CONT, andmove_file_file()removes the source file, leaving no copy neither in source nor in destination.The simplest fix in the scenario with a write-protected destination is provided in the first patch, which adds an attempt to truncate the file or append 0 bytes to the file in
shell_open()before creating the fake directory entry in the local VFS cache, and returns an error on failure. It also has a positive side effect of failing early, before creating the local temporary copy etc.But the first patch alone does not solve the issue when the remote error occurs later during the copy, e.g. in an out of space situation. So the task was to make the
send(andappend) script detect and report the errors while also still working on the lowest common denominator of a shell environment. To do it, I had to implement some tests and some primitive test infrastructure for these scripts, which, as I've found out later, was already discussed in #3635. The test scripts are designed to run wherever the GitHub CI is running, they assume a fairly POSIX-compliant sh and are known to work indash,bash, and FreeBSD Almquist shell. It's the subject of the second patch.The third patch contains the updated
sendandappendscripts. They are written in an archaic dialect, so that Heirloom Bourne shell can run them. They handle the write errors, consume the rest of the data, and respond with### 500.But even when the scripts return
### 500andmc_close()returns an error,dst_statusis still equal toDEST_FULL, which is obviously a lie. The fourth patch catches this condition and changesdst_statustoDEST_SHORT_QUERY, asking the user to choose to keep or delete the partial file, and preventing the deletion of the source file inmove_file_file().* Needs: #5155.Well it's not a hard dependency, so I have rebased this PR on the master branch to ease reviewing.Checklist
git commit --amend -smake indent && make check)