[Bug 17265] New: Make koha-create-defaults less greedy
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17265 Bug ID: 17265 Summary: Make koha-create-defaults less greedy Change sponsored?: --- Product: Koha Version: unspecified Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Packaging Assignee: koha-bugs@lists.koha-community.org Reporter: magnus@libriotech.no QA Contact: testopia@bugs.koha-community.org CC: mirko@abunchofthings.net koha-dump-defaults runs mysqldump and then pipes the result to sed, to replace every occurence of the site name with the placeholder __KOHASITE__ mysqldump --databases --host="$mysqlhost" --user="$mysqluser" \ --password="$mysqlpass" "$mysqldb" | sed "s/$name/__KOHASITE__/g" I had used the silly name "data" as the site name for my "template instance", and this resulted in innocent things like -- Dumping __KOHASITE__ for table `zebraqueue` and bad things like 'Edit catalog (Modify bibliographic/holdings __KOHASITE__)' or this, in biblioitems.marcxml: <__KOHASITE__field> All told there were 7235 occurences of __KOHASITE__ in my rather small SQL file. As suggested by drojf on IRC, I *think* this would be fixed if we replaced "koha_$name" __INSTANCENAME__, instead of just $name. -- 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=17265 --- Comment #1 from Magnus Enger <magnus@libriotech.no> --- (In reply to Magnus Enger from comment #0)
As suggested by drojf on IRC, I *think* this would be fixed if we replaced "koha_$name" __INSTANCENAME__, instead of just $name.
That should of course be __KOHASITE__, not __INSTANCENAME__. -- 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=17265 --- Comment #2 from Magnus Enger <magnus@libriotech.no> --- ...and we would need to change line 744 of koha-create accordingly: sed "s/__KOHASITE__/$name/g" | -- 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=17265 Magnus Enger <magnus@libriotech.no> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Small patch Status|NEW |Needs Signoff -- 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=17265 --- Comment #3 from Magnus Enger <magnus@libriotech.no> --- Created attachment 55338 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=55338&action=edit Bug 17265 - Make koha-create-defaults less greedy koha-create-defaults substitutes the instance name with the placeholder __KOHASITE__ in the SQL file that it creates. If the instance name is something common, like "data", this means that way too many substitutions will be made, and when koha-create uses the SQL file as a template, broken data can be the result. The solution in this patch was suggested by drojf on IRC. To test: - Create an instance called "data" - Run "sudo koha-dump-defaults data > test.sql" - Take a look at test.sql and verify there are way too many occurences of __KOHASITE__, like "-- Dumping __KOHASITE__ for table `accountlines`" - Apply the patch - Copy the resulting koha-create and koha-dump-defaults to somewhere running off the packages - Run "sudo koha-dump-defaults data > test.sql" again and verify there are only 4 occurrences of __KOHASITE__, in places that make sense - Create an instance with something like: $ gzip test.sql $ sudo koha-create --create-db --defaultsql test.sql.gz test17265 - Verify that you have a working Koha install -- 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=17265 Andreas Roussos <arouss1980@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |arouss1980@gmail.com --- Comment #4 from Andreas Roussos <arouss1980@gmail.com> --- Apologies for being pedantic, but may I suggest a small change to the bug title? 'koha-create-defaults' is not a valid command. In order to find this bug in future BZ/git searches for 'koha-create' or 'koha-dump-defaults' I think the title should be: "Make koha-create and koha-dump-defaults less greedy" -- 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=17265 Andreas Roussos <arouss1980@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #55338|0 |1 is obsolete| | --- Comment #5 from Andreas Roussos <arouss1980@gmail.com> --- Created attachment 55458 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=55458&action=edit Bug 17265 - Make koha-create-defaults less greedy koha-create-defaults substitutes the instance name with the placeholder __KOHASITE__ in the SQL file that it creates. If the instance name is something common, like "data", this means that way too many substitutions will be made, and when koha-create uses the SQL file as a template, broken data can be the result. The solution in this patch was suggested by drojf on IRC. To test: - Create an instance called "data" - Run "sudo koha-dump-defaults data > test.sql" - Take a look at test.sql and verify there are way too many occurences of __KOHASITE__, like "-- Dumping __KOHASITE__ for table `accountlines`" - Apply the patch - Copy the resulting koha-create and koha-dump-defaults to somewhere running off the packages - Run "sudo koha-dump-defaults data > test.sql" again and verify there are only 4 occurrences of __KOHASITE__, in places that make sense - Create an instance with something like: $ gzip test.sql $ sudo koha-create --create-db --defaultsql test.sql.gz test17265 - Verify that you have a working Koha install Signed-off-by: Andreas Roussos <arouss1980@gmail.com> Works as expected. -- 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=17265 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Make koha-create-defaults |Make koha-create and |less greedy |koha-dump-defaults less | |greedy CC| |katrin.fischer@bsz-bw.de -- 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=17265 --- Comment #6 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Changed the bug title according to Andreas' suggestion. :) -- 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=17265 Andreas Roussos <arouss1980@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off --- Comment #7 from Andreas Roussos <arouss1980@gmail.com> --- Sorry, forgot to set Status to 'Signed Off', setting it now. -- 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=17265 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- 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=17265 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #55458|0 |1 is obsolete| | --- Comment #8 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 58540 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=58540&action=edit Bug 17265 - Make koha-create-defaults less greedy koha-create-defaults substitutes the instance name with the placeholder __KOHASITE__ in the SQL file that it creates. If the instance name is something common, like "data", this means that way too many substitutions will be made, and when koha-create uses the SQL file as a template, broken data can be the result. The solution in this patch was suggested by drojf on IRC. To test: - Create an instance called "data" - Run "sudo koha-dump-defaults data > test.sql" - Take a look at test.sql and verify there are way too many occurences of __KOHASITE__, like "-- Dumping __KOHASITE__ for table `accountlines`" - Apply the patch - Copy the resulting koha-create and koha-dump-defaults to somewhere running off the packages - Run "sudo koha-dump-defaults data > test.sql" again and verify there are only 4 occurrences of __KOHASITE__, in places that make sense - Create an instance with something like: $ gzip test.sql $ sudo koha-create --create-db --defaultsql test.sql.gz test17265 - Verify that you have a working Koha install Signed-off-by: Andreas Roussos <arouss1980@gmail.com> Works as expected. Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- 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=17265 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to Master CC| |kyle@bywatersolutions.com --- Comment #9 from Kyle M Hall <kyle@bywatersolutions.com> --- Pushed to master for 17.05, thanks Magnus! -- 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=17265 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to Master |Pushed to Stable --- Comment #10 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- This patch has been pushed to 16.11.x and will be in 16.11.02. -- 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=17265 Julian Maurice <julian.maurice@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |julian.maurice@biblibre.com --- Comment #11 from Julian Maurice <julian.maurice@biblibre.com> --- Pushed to 3.22.x for 3.22.15 -- 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=17265 Mason James <mtj@kohaaloha.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mtj@kohaaloha.com --- Comment #12 from Mason James <mtj@kohaaloha.com> --- Pushed to 16.05.x, for 16.05.08 release -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org