[Bug 21440] New: koha-create expects the file passed by $DEFAULTSQL to be in gzip format
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21440 Bug ID: 21440 Summary: koha-create expects the file passed by $DEFAULTSQL to be in gzip format Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: major Priority: P3 Component: Installation and upgrade (command-line installer) Assignee: koha-bugs@lists.koha-community.org Reporter: arouss1980@gmail.com QA Contact: testopia@bugs.koha-community.org When setting up a new Koha instance with `koha-create`, you have the option of specifying an SQL file with default data to load. This is done by setting the DEFAULTSQL variable in /etc/koha/koha-sites.conf to point to a filename of your choice. However, if you set the DEFAULTSQL variable to something like this: DEFAULTSQL="/home/user/dump.sql" and then run `koha-create --create-db instance`, you get this error: gzip: /home/user/dump.sql: not in gzip format This is due to the following code from debian/scripts/koha-create, where the call to `zcat` fails if the file is not in gzip format. if [ -e "$DEFAULTSQL" ] then # Populate the database with default content. zcat "$DEFAULTSQL" | sed "s/__KOHASITE__/koha_$name/g" | mysql --host="$mysqlhost" --user="$mysqluser" --password="$mysqlpwd" "$mysqldb" -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21440 Andreas Roussos <arouss1980@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|koha-bugs@lists.koha-commun |arouss1980@gmail.com |ity.org | -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21440 --- Comment #1 from Andreas Roussos <arouss1980@gmail.com> --- Created attachment 79541 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=79541&action=edit Bug 21440: koha-create expects the file passed by $DEFAULTSQL to be in gzip format koha-create contains a call to `zcat` which fails if the file passed as an argument is not in gzip format. This patch fixes the issue by adding the -f flag to the zcat call in koha-create, as per the top-voted answers in the following SE URLs: https://unix.stackexchange.com/a/77309 https://unix.stackexchange.com/a/131944 Test plan: 1) in /etc/koha/koha-sites.conf, set the DEFAULTSQL variable to point to an _uncompressed_ SQL database dump 2) run `koha-create --create-db instance` and notice how it fails with: gzip: /path/to/dump.sql: not in gzip format 3) apply the patch 4) notice the extra line of information "The SQL file can be optionally compressed with gzip" in koha-sites.conf 5) run the `koha-create` command again, this time it should work 6) repeat with DEFAULTSQL pointing to a gzip'd dump, it should work too -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21440 Andreas Roussos <arouss1980@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21440 Andreas Roussos <arouss1980@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Small patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21440 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #79541|0 |1 is obsolete| | --- Comment #2 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 80216 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=80216&action=edit Bug 21440: koha-create expects the file passed by $DEFAULTSQL to be in gzip format koha-create contains a call to `zcat` which fails if the file passed as an argument is not in gzip format. This patch fixes the issue by adding the -f flag to the zcat call in koha-create, as per the top-voted answers in the following SE URLs: https://unix.stackexchange.com/a/77309 https://unix.stackexchange.com/a/131944 Test plan: 1) in /etc/koha/koha-sites.conf, set the DEFAULTSQL variable to point to an _uncompressed_ SQL database dump 2) run `koha-create --create-db instance` and notice how it fails with: gzip: /path/to/dump.sql: not in gzip format 3) apply the patch 4) notice the extra line of information "The SQL file can be optionally compressed with gzip" in koha-sites.conf 5) run the `koha-create` command again, this time it should work 6) repeat with DEFAULTSQL pointing to a gzip'd dump, it should work too Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21440 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off CC| |martin.renvoize@ptfs-europe | |.com --- Comment #3 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Nice little fix that works well, signing off. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21440 Chris Cormack <chris@bigballofwax.co.nz> 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=21440 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #80216|0 |1 is obsolete| | --- Comment #4 from Chris Cormack <chris@bigballofwax.co.nz> --- Created attachment 80235 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=80235&action=edit Bug 21440: koha-create expects the file passed by $DEFAULTSQL to be in gzip format koha-create contains a call to `zcat` which fails if the file passed as an argument is not in gzip format. This patch fixes the issue by adding the -f flag to the zcat call in koha-create, as per the top-voted answers in the following SE URLs: https://unix.stackexchange.com/a/77309 https://unix.stackexchange.com/a/131944 Test plan: 1) in /etc/koha/koha-sites.conf, set the DEFAULTSQL variable to point to an _uncompressed_ SQL database dump 2) run `koha-create --create-db instance` and notice how it fails with: gzip: /path/to/dump.sql: not in gzip format 3) apply the patch 4) notice the extra line of information "The SQL file can be optionally compressed with gzip" in koha-sites.conf 5) run the `koha-create` command again, this time it should work 6) repeat with DEFAULTSQL pointing to a gzip'd dump, it should work too Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21440 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |nick@bywatersolutions.com Status|Passed QA |Pushed to Master --- Comment #5 from Nick Clemens <nick@bywatersolutions.com> --- Awesome work all! Pushed to master for 18.11 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21440 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to Master |Pushed to Stable --- Comment #6 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Pushed to 18.05.x for 18.05.05 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21440 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Text to go in the| |Allow koha-create to accept release notes| |both compressed and | |uncompressed files for | |DEFAULTSQL Status|Pushed to Stable |Pushed to Master -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21440 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to Master |Pushed to Stable -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21440 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Text to go in the|Allow koha-create to accept |Add support to koha-create release notes|both compressed and |to allow it to accept both |uncompressed files for |compressed and uncompressed |DEFAULTSQL |files for DEFAULTSQL -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21440 Fridolin SOMERS <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|Pushed to Stable |RESOLVED CC| |fridolin.somers@biblibre.co | |m --- Comment #7 from Fridolin SOMERS <fridolin.somers@biblibre.com> --- Pushed to 17.11.x for 17.11.11 -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org