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

Test helper doesn't correctly drop the database (?) #59

Closed
ged opened this issue Dec 28, 2010 · 2 comments
Closed

Test helper doesn't correctly drop the database (?) #59

ged opened this issue Dec 28, 2010 · 2 comments

Comments

@ged
Copy link
Owner

ged commented Dec 28, 2010

Original report by Michael Granger (Bitbucket: ged, GitHub: ged).


[Via email]

you need to quote the drop database command

Änderung:        209:89348c8bb6d1
Datum:           Mon Dec 06 12:00:11 2010 -0800



#!diff
/media/87ce4eeb-6589-4edc-a13a-ac286d780634/experiments/diaspora/ruby-pg$ hg diff
diff -r 89348c8bb6d1 spec/lib/helpers.rb
--- a/spec/lib/helpers.rb    Mon Dec 06 12:00:11 2010 -0800
+++ b/spec/lib/helpers.rb    Tue Dec 28 17:28:25 2010 +0100
@@ -209,7 +209,7 @@
             sleep 2
 
             $stderr.puts "Creating the test DB"
-            log_and_run @logfile, 'psql', '-e', '-c', 'DROP DATABASE IF EXISTS test', 'postgres'
+            log_and_run @logfile, 'psql', '-e', '-c', "\'DROP DATABASE IF EXISTS test\'", 'postgres'
             log_and_run @logfile, 'createdb', '-e', 'test'
 
         rescue => err



SourcePackage: postgresql-8.4
Package: postgresql (not installed)
Tags:  ubuntu-unr
ProblemType: Bug
ProcEnviron:
  SHELL=/bin/bash
  LANG=de_DE.UTF-8
Uname: Linux 2.6.31-22-generic i686
ProcVersionSignature: Ubuntu 2.6.31-22.63-generic
InstallationMedia: Ubuntu-Netbook-Remix 9.10 "Karmic Koala" - Release i386 (20091028.4)
Architecture: i386
Date: Tue Dec 28 17:33:59 2010

--
James Michael DuPont
Member of Free Libre Open Source Software Kosova and Albania flossk.org flossal.org

@ged
Copy link
Owner Author

ged commented Dec 28, 2010

Original comment by Michael Granger (Bitbucket: ged, GitHub: ged).


Actually, I'm not sure what issue this patch is supposed to fix. The arguments in question are being passed to log_and_run(), which in turn passes the array to either system() or exec(), so it doesn't need to be quoted. Applying the patch makes the specs not work under MacOS X 10.6.5, FreeBSD 7.x and 8.x, Ubuntu 10.10, and CentOS 5.4.

The error (on all platforms) is:

  RuntimeError during test setup: Command failed: [psql -e -c \
    'DROP DATABASE IF EXISTS test' postgres]

Reverting the patch fixes the issue.

@ged
Copy link
Owner Author

ged commented Jan 19, 2011

Original comment by Michael Granger (Bitbucket: ged, GitHub: ged).


No response from the original reporter, and I can't reproduce his problem.

@ged ged closed this as completed Jan 19, 2011
@ged ged added this to the Pending milestone Oct 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant