[Bug 37038] New: koha-elasticsearch creates a file named 0
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37038 Bug ID: 37038 Summary: koha-elasticsearch creates a file named 0 Change sponsored?: --- Product: Koha Version: unspecified Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Command-line Utilities Assignee: januszop@gmail.com Reporter: januszop@gmail.com QA Contact: testopia@bugs.koha-community.org CC: robin@catalyst.net.nz After execution of koha-elasticsearch command a file names 0 remains in the current directory. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37038 Janusz Kaczmarek <januszop@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Trivial patch Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37038 --- Comment #1 from Janusz Kaczmarek <januszop@gmail.com> --- Created attachment 167487 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=167487&action=edit Bug 37038: koha-elasticsearch creates a file named 0 After execution of koha-elasticsearch command a file named 0 remains in the current directory. Inside the single parentheses, the character '>' is treated as a file redirection, not as a comparison operator. Test plan: ========== 1. Have a test installation with Elasticsearch. As root, perform: ./debian/scripts/koha-elasticsearch --rebuild kohadev When the command finishes, check the contents of the current directory (ls -ltr | tail). You sould notice a fresh file named '0' 2. Apply the patch. Delete the file named 0. 3. Repeat p. 1. There should be no file named 0 now. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37038 Janusz Kaczmarek <januszop@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|enhancement |trivial CC| |tomascohen@gmail.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37038 Roman Dolny <roman.dolny@jezuici.pl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37038 Roman Dolny <roman.dolny@jezuici.pl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #167487|0 |1 is obsolete| | --- Comment #2 from Roman Dolny <roman.dolny@jezuici.pl> --- Created attachment 167491 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=167491&action=edit Bug 37038: koha-elasticsearch creates a file named 0 After execution of koha-elasticsearch command a file named 0 remains in the current directory. Inside the single parentheses, the character '>' is treated as a file redirection, not as a comparison operator. Test plan: ========== 1. Have a test installation with Elasticsearch. As root, perform: ./debian/scripts/koha-elasticsearch --rebuild kohadev When the command finishes, check the contents of the current directory (ls -ltr | tail). You sould notice a fresh file named '0' 2. Apply the patch. Delete the file named 0. 3. Repeat p. 1. There should be no file named 0 now. Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37038 --- Comment #3 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Shouldn't it be if [ "${clo_commit_size}" -gt "0" ]; then ? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37038 --- Comment #4 from Janusz Kaczmarek <januszop@gmail.com> --- (In reply to Tomás Cohen Arazi from comment #3)
Shouldn't it be
if [ "${clo_commit_size}" -gt "0" ]; then
?
Thanks, Tomás, for having a look. Well, yes, and it was my first shot. It would be OK, provided that clo_commit_size is defined and is a integer number. Otherwise we get: ./debian/scripts/koha-elasticsearch: 93: [: Illegal number: I have tried several options (including nested ifs) -- the proposed solution seems to be a reasonable, working trade-off. But I'm not a bash expert ;) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37038 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37038 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #167491|0 |1 is obsolete| | --- Comment #5 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 168220 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=168220&action=edit Bug 37038: koha-elasticsearch creates a file named 0 After execution of koha-elasticsearch command a file named 0 remains in the current directory. Inside the single parentheses, the character '>' is treated as a file redirection, not as a comparison operator. Test plan: ========== 1. Have a test installation with Elasticsearch. As root, perform: ./debian/scripts/koha-elasticsearch --rebuild kohadev When the command finishes, check the contents of the current directory (ls -ltr | tail). You sould notice a fresh file named '0' 2. Apply the patch. Delete the file named 0. 3. Repeat p. 1. There should be no file named 0 now. Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37038 --- Comment #6 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 168221 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=168221&action=edit Bug 37038: (QA follow-up) Replace \> by -gt Note that -gt is the bash integer comparison and > is the lexical one: $ if [ '1' \> '09' ]; then echo true; fi true $ if [ '1' -gt '09' ]; then echo true; fi Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37038 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |m.de.rooy@rijksmuseum.nl |y.org | CC| |m.de.rooy@rijksmuseum.nl -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37038 --- Comment #7 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- (In reply to Janusz Kaczmarek from comment #4)
(In reply to Tomás Cohen Arazi from comment #3)
Shouldn't it be
if [ "${clo_commit_size}" -gt "0" ]; then
?
Thanks, Tomás, for having a look.
Well, yes, and it was my first shot. It would be OK, provided that clo_commit_size is defined and is a integer number.
Otherwise we get:
./debian/scripts/koha-elasticsearch: 93: [: Illegal number:
I have tried several options (including nested ifs) -- the proposed solution seems to be a reasonable, working trade-off. But I'm not a bash expert ;)
Ah just seeing this now.. Hang on. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37038 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |BLOCKED -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37038 --- Comment #8 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- A simple workaround might be: clo_processes=aa; if [ "${clo_processes}" -gt 0 ] 2>/dev/null; then echo true; fi for bin/sh We just oppress the warn. The condition is false as expected. And for bin/bash this would just work: clo_processes=aa; if [[ "${clo_processes}" -gt 0 ]]; then echo true; fi But this script is marked bin/sh Which actually is confusing when you git grep bash in that folder.. But not for here. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37038 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|BLOCKED |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37038 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #168221|0 |1 is obsolete| | --- Comment #9 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 168222 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=168222&action=edit Bug 37038: (QA follow-up) Replace \> by -gt Note that -gt is the bash integer comparison and > is the lexical one: $ if [ '1' \> '09' ]; then echo true; fi true $ if [ '1' -gt '09' ]; then echo true; fi Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> [EDIT] Added the dev/null redirection to suppress warn in bin/sh. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37038 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dcook@prosentient.com.au --- Comment #10 from David Cook <dcook@prosentient.com.au> --- O_O Good catch folks -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37038 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |24.11.00 released in| | Status|Passed QA |Pushed to main -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37038 --- Comment #11 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Pushed for 24.11! Well done everyone, thank you! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37038 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to main |Pushed to stable Version(s)|24.11.00 |24.11.00,24.05.06 released in| | CC| |lucas@bywatersolutions.com --- Comment #12 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Backported to 24.05.x for upcoming 24.05.06 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37038 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)|24.11.00,24.05.06 |24.11.00,24.05.06,23.11.11 released in| | CC| |fridolin.somers@biblibre.co | |m Status|Pushed to stable |Pushed to oldstable --- Comment #13 from Fridolin Somers <fridolin.somers@biblibre.com> --- Pushed to 23.11.x for 23.11.11 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37038 Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|Pushed to oldstable |RESOLVED CC| |wainuiwitikapark@catalyst.n | |et.nz --- Comment #14 from Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz> --- Not backporting to 22.11 -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org