Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix temp directories left behind #33

Merged

Conversation

pedropombeiro
Copy link
Collaborator

My last change to scantofile-0.2.4-1.sh unfortunately introduced a bug where the rm -rf command was not being applied to a correctly named directory. This PR fixes it and further cleans up the scripts to make more use of variables to avoid repetition.

@pedropombeiro pedropombeiro force-pushed the pedropombeiro/fix-delete-temp-dir branch from 406d886 to 4e04b26 Compare September 22, 2024 15:12
# `brother4:net1;dev0` device name gets passed to scanimage, which it refuses as an invalid device name for some reason.
# Let's use the default scanner for now
# scanimage -l 0 -t 0 -x 215 -y 297 --device-name="$1" --resolution="$2" --batch="$3"
scanimage -l 0 -t 0 -x 215 -y 297 --format=pnm --resolution="$2" --batch="$3"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

note: Explicitly specify --format=pnm to avoid unnecessary warning fallback message.

@PhilippMundhenk
Copy link
Owner

PhilippMundhenk commented Sep 22, 2024

Looks pretty good. Two things though:

  • It is possible that the script is called from web interface, without parameters, thus $1 will not contain the device. In this case, we need to call scan_cmd without device set, as this will use the default device. A simple "if" should suffice.
  • Let's push that to a branch, as this will trigger the git action to build a separate container that can be tested easily by pulling from ghcr

@PhilippMundhenk PhilippMundhenk changed the base branch from master to fixfeat_tempDir_deviceName September 22, 2024 16:45
@pedropombeiro
Copy link
Collaborator Author

It is possible that the script is called from web interface, without parameters, thus $1 will not contain the device. In this case, we need to call scan_cmd without device set, as this will use the default device. A simple "if" should suffice.

@PhilippMundhenk Keep in mind that $device is not being used at the moment. The only thing we're doing is passing it to scan_cmd.

@PhilippMundhenk
Copy link
Owner

Yes, indeed, by passing it there, if being called from the web interface, $device is empty, thus passing --device-name="" leading to a SegFault of the driver. Thus, we should only pass this parameter, if we have it set correctly (i.e., called from buttons, not web interface).

@pedropombeiro
Copy link
Collaborator Author

Yes, indeed, by passing it there, if being called from the web interface, $device is empty, thus passing --device-name="" leading to a SegFault of the driver. Thus, we should only pass this parameter, if we have it set correctly (i.e., called from buttons, not web interface).

@PhilippMundhenk can you please point me to where we're passing --device-name=""?

@PhilippMundhenk
Copy link
Owner

We aren't. Starting to see ghosts switching between issues and branches. It is passed to scan_cmd, but never to scanimage from there.

@PhilippMundhenk PhilippMundhenk merged commit 5c4fb30 into fixfeat_tempDir_deviceName Sep 22, 2024
1 check passed
@PhilippMundhenk
Copy link
Owner

Merged this to branch, will do a quick test of the branch, once container is ready, then merge to master

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