pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #7514: postgres -k no longer works with spaces in the path
8+ messages / 5 participants
[nested] [flat]

* BUG #7514: postgres -k no longer works with spaces in the path
@ 2012-09-01 04:16 murrayc@murrayc.com
  2012-09-04 14:31 ` Re: BUG #7514: postgres -k no longer works with spaces in the path Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 8+ messages in thread

From: murrayc@murrayc.com @ 2012-09-01 04:16 UTC (permalink / raw)
  To: pgsql-bugs

The following bug has been logged on the website:

Bug reference:      7514
Logged by:          Murray Cumming
Email address:      murrayc@murrayc.com
PostgreSQL version: 9.1.5
Operating system:   Fedora Linux 17
Description:        

At some point, probably in 9.1.5, the -k option to Postgres ("Unix-domain
socket location" in --help), stopped accepting paths that contain spaces.

For instance,
-k '/tmp/testglom2FPDKW/path with spaces/some_postgres_data'

It now fails with this error:
FATAL:  invalid list syntax for "unix_socket_directories"

This is not critical, but it showed up in the regression tests for Glom. And
users are fairly likely to use paths with spaces.

-k apparently accepts a comma-separated list, so there should be no need to
check for spaces.





^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: BUG #7514: postgres -k no longer works with spaces in the path
  2012-09-01 04:16 BUG #7514: postgres -k no longer works with spaces in the path murrayc@murrayc.com
@ 2012-09-04 14:31 ` Tom Lane <tgl@sss.pgh.pa.us>
  2012-09-04 18:22   ` Re: BUG #7514: postgres -k no longer works with spaces in the path Murray Cumming <murrayc@murrayc.com>
  0 siblings, 1 reply; 8+ messages in thread

From: Tom Lane @ 2012-09-04 14:31 UTC (permalink / raw)
  To: murrayc@murrayc.com; +Cc: pgsql-bugs

murrayc@murrayc.com writes:
> At some point, probably in 9.1.5, the -k option to Postgres ("Unix-domain
> socket location" in --help), stopped accepting paths that contain spaces.

> For instance,
> -k '/tmp/testglom2FPDKW/path with spaces/some_postgres_data'

> It now fails with this error:
> FATAL:  invalid list syntax for "unix_socket_directories"

Ah, you're using the latest Fedora packaging of 9.1.x, which includes a
back-ported version of the unix_socket_directories change that's in
HEAD.  -k now effectively takes a list of directory names, not just
one, and it's pickier about whitespace.

IIRC, you can make it work if you put double quotes around the
space-containing name, so it'd look like this:

	-k '"/blah blah blah"'


			regards, tom lane




^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: BUG #7514: postgres -k no longer works with spaces in the path
  2012-09-01 04:16 BUG #7514: postgres -k no longer works with spaces in the path murrayc@murrayc.com
  2012-09-04 14:31 ` Re: BUG #7514: postgres -k no longer works with spaces in the path Tom Lane <tgl@sss.pgh.pa.us>
@ 2012-09-04 18:22   ` Murray Cumming <murrayc@murrayc.com>
  2012-09-05 22:57     ` Re: BUG #7514: postgres -k no longer works with spaces in the path Peter Eisentraut <peter_e@gmx.net>
  2012-09-07 07:21     ` Re: BUG #7514: postgres -k no longer works with spaces in the path Murray Cumming <murrayc@murrayc.com>
  0 siblings, 2 replies; 8+ messages in thread

From: Murray Cumming @ 2012-09-04 18:22 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-bugs

On Tue, 2012-09-04 at 10:31 -0400, Tom Lane wrote:
> murrayc@murrayc.com writes:
> > At some point, probably in 9.1.5, the -k option to Postgres ("Unix-domain
> > socket location" in --help), stopped accepting paths that contain spaces.
> 
> > For instance,
> > -k '/tmp/testglom2FPDKW/path with spaces/some_postgres_data'
> 
> > It now fails with this error:
> > FATAL:  invalid list syntax for "unix_socket_directories"
> 
> Ah, you're using the latest Fedora packaging of 9.1.x, which includes a
> back-ported version of the unix_socket_directories change that's in
> HEAD.  -k now effectively takes a list of directory names, not just
> one, and it's pickier about whitespace.
> 
> IIRC, you can make it work if you put double quotes around the
> space-containing name, so it'd look like this:
> 
> 	-k '"/blah blah blah"'

Yes, thanks, that works for spaces, though it's rather odd.

However, how should I now specify a path that has a " or a /, or \,
which now cause similar errors with -k? Previously I could just use
g_shell_quote() and forget about it:
http://developer.gnome.org/glib/stable/glib-Shell-related-Utilities.html#g-shell-quote

To be honest, I don't have much interest in, or understanding of, this
-k option anyway. I just use it because, when starting my temporary
postgresql instance, it otherwise defaults to /var/run/postgresql/ (at
least in this distro build) which is not available to normal users. I
currently just specify the same directory that the postgresql data is
in. Maybe I should just use /tmp instead.

-- 
murrayc@murrayc.com
www.murrayc.com
www.openismus.com





^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: BUG #7514: postgres -k no longer works with spaces in the path
  2012-09-01 04:16 BUG #7514: postgres -k no longer works with spaces in the path murrayc@murrayc.com
  2012-09-04 14:31 ` Re: BUG #7514: postgres -k no longer works with spaces in the path Tom Lane <tgl@sss.pgh.pa.us>
  2012-09-04 18:22   ` Re: BUG #7514: postgres -k no longer works with spaces in the path Murray Cumming <murrayc@murrayc.com>
@ 2012-09-05 22:57     ` Peter Eisentraut <peter_e@gmx.net>
  2012-09-05 23:05       ` Re: BUG #7514: postgres -k no longer works with spaces in the path Tom Lane <tgl@sss.pgh.pa.us>
  2012-09-06 00:55       ` Re: BUG #7514: postgres -k no longer works with spaces in the path Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 2 replies; 8+ messages in thread

From: Peter Eisentraut @ 2012-09-05 22:57 UTC (permalink / raw)
  To: Murray Cumming <murrayc@murrayc.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-bugs

On 9/4/12 2:22 PM, Murray Cumming wrote:
> On Tue, 2012-09-04 at 10:31 -0400, Tom Lane wrote:
>> murrayc@murrayc.com writes:
>>> At some point, probably in 9.1.5, the -k option to Postgres ("Unix-domain
>>> socket location" in --help), stopped accepting paths that contain spaces.
>>
>>> For instance,
>>> -k '/tmp/testglom2FPDKW/path with spaces/some_postgres_data'
>>
>>> It now fails with this error:
>>> FATAL:  invalid list syntax for "unix_socket_directories"
>>
>> Ah, you're using the latest Fedora packaging of 9.1.x, which includes a
>> back-ported version of the unix_socket_directories change that's in
>> HEAD.  -k now effectively takes a list of directory names, not just
>> one, and it's pickier about whitespace.
>>
>> IIRC, you can make it work if you put double quotes around the
>> space-containing name, so it'd look like this:
>>
>> 	-k '"/blah blah blah"'
> 
> Yes, thanks, that works for spaces, though it's rather odd.
> 
> However, how should I now specify a path that has a " or a /, or \,
> which now cause similar errors with -k? Previously I could just use
> g_shell_quote() and forget about it:
> http://developer.gnome.org/glib/stable/glib-Shell-related-Utilities.html#g-shell-quote
> 
> To be honest, I don't have much interest in, or understanding of, this
> -k option anyway. I just use it because, when starting my temporary
> postgresql instance, it otherwise defaults to /var/run/postgresql/ (at
> least in this distro build) which is not available to normal users. I
> currently just specify the same directory that the postgresql data is
> in. Maybe I should just use /tmp instead.

Maybe it would be easier if multiple -k options accumulated.  That would
make the whole quoting business easier, and it would avoid breaking
compatibility.





^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: BUG #7514: postgres -k no longer works with spaces in the path
  2012-09-01 04:16 BUG #7514: postgres -k no longer works with spaces in the path murrayc@murrayc.com
  2012-09-04 14:31 ` Re: BUG #7514: postgres -k no longer works with spaces in the path Tom Lane <tgl@sss.pgh.pa.us>
  2012-09-04 18:22   ` Re: BUG #7514: postgres -k no longer works with spaces in the path Murray Cumming <murrayc@murrayc.com>
  2012-09-05 22:57     ` Re: BUG #7514: postgres -k no longer works with spaces in the path Peter Eisentraut <peter_e@gmx.net>
@ 2012-09-05 23:05       ` Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 0 replies; 8+ messages in thread

From: Tom Lane @ 2012-09-05 23:05 UTC (permalink / raw)
  To: Peter Eisentraut <peter_e@gmx.net>; +Cc: Murray Cumming <murrayc@murrayc.com>; pgsql-bugs

Peter Eisentraut <peter_e@gmx.net> writes:
> Maybe it would be easier if multiple -k options accumulated.

Hm, interesting thought, but how would we make that play in the generic
GUC support?  Or are you imagining that we'd just kluge up -k with some
single-purpose code?

			regards, tom lane




^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: BUG #7514: postgres -k no longer works with spaces in the path
  2012-09-01 04:16 BUG #7514: postgres -k no longer works with spaces in the path murrayc@murrayc.com
  2012-09-04 14:31 ` Re: BUG #7514: postgres -k no longer works with spaces in the path Tom Lane <tgl@sss.pgh.pa.us>
  2012-09-04 18:22   ` Re: BUG #7514: postgres -k no longer works with spaces in the path Murray Cumming <murrayc@murrayc.com>
  2012-09-05 22:57     ` Re: BUG #7514: postgres -k no longer works with spaces in the path Peter Eisentraut <peter_e@gmx.net>
@ 2012-09-06 00:55       ` Tom Lane <tgl@sss.pgh.pa.us>
  2012-09-06 18:52         ` Re: BUG #7514: postgres -k no longer works with spaces in the path Robert Haas <robertmhaas@gmail.com>
  1 sibling, 1 reply; 8+ messages in thread

From: Tom Lane @ 2012-09-06 00:55 UTC (permalink / raw)
  To: Peter Eisentraut <peter_e@gmx.net>; +Cc: Murray Cumming <murrayc@murrayc.com>; pgsql-bugs

Peter Eisentraut <peter_e@gmx.net> writes:
> Maybe it would be easier if multiple -k options accumulated.

After further thought I'm not very enamored of that concept.  We've made
considerable compromises to ensure that every postmaster command-line
option corresponds exactly to some GUC parameter; it does not seem to me
that -k is important enough to deserve an exception.

However, it occurs to me that Murray's original complaint about spaces
in -k pathnames could be dealt with via very narrow changes in
SplitDirectoriesString.  That function was modeled on
SplitIdentifierString, with perhaps not enough thought about the
differences between identifiers and pathnames.  In particular, I suggest
that there's no need to reject embedded spaces in pathnames, and plenty
of systems on which it's important not to.  (Think "Program Files" on
Windows, for instance.)  It probably still makes sense to trim leading
and trailing whitespace, but let's allow embedded spaces.

If we did that, the new code would be incompatible with the old only for
paths including commas, leading double quotes, or leading/trailing
whitespace.  I submit that all of those cases are pretty uncommon,
especially compared to embedded space.

			regards, tom lane




^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: BUG #7514: postgres -k no longer works with spaces in the path
  2012-09-01 04:16 BUG #7514: postgres -k no longer works with spaces in the path murrayc@murrayc.com
  2012-09-04 14:31 ` Re: BUG #7514: postgres -k no longer works with spaces in the path Tom Lane <tgl@sss.pgh.pa.us>
  2012-09-04 18:22   ` Re: BUG #7514: postgres -k no longer works with spaces in the path Murray Cumming <murrayc@murrayc.com>
  2012-09-05 22:57     ` Re: BUG #7514: postgres -k no longer works with spaces in the path Peter Eisentraut <peter_e@gmx.net>
  2012-09-06 00:55       ` Re: BUG #7514: postgres -k no longer works with spaces in the path Tom Lane <tgl@sss.pgh.pa.us>
@ 2012-09-06 18:52         ` Robert Haas <robertmhaas@gmail.com>
  0 siblings, 0 replies; 8+ messages in thread

From: Robert Haas @ 2012-09-06 18:52 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Peter Eisentraut <peter_e@gmx.net>; Murray Cumming <murrayc@murrayc.com>; pgsql-bugs

On Wed, Sep 5, 2012 at 8:55 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Peter Eisentraut <peter_e@gmx.net> writes:
>> Maybe it would be easier if multiple -k options accumulated.
>
> After further thought I'm not very enamored of that concept.  We've made
> considerable compromises to ensure that every postmaster command-line
> option corresponds exactly to some GUC parameter; it does not seem to me
> that -k is important enough to deserve an exception.
>
> However, it occurs to me that Murray's original complaint about spaces
> in -k pathnames could be dealt with via very narrow changes in
> SplitDirectoriesString.  That function was modeled on
> SplitIdentifierString, with perhaps not enough thought about the
> differences between identifiers and pathnames.  In particular, I suggest
> that there's no need to reject embedded spaces in pathnames, and plenty
> of systems on which it's important not to.  (Think "Program Files" on
> Windows, for instance.)  It probably still makes sense to trim leading
> and trailing whitespace, but let's allow embedded spaces.
>
> If we did that, the new code would be incompatible with the old only for
> paths including commas, leading double quotes, or leading/trailing
> whitespace.  I submit that all of those cases are pretty uncommon,
> especially compared to embedded space.

That seems reasonable.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company




^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: BUG #7514: postgres -k no longer works with spaces in the path
  2012-09-01 04:16 BUG #7514: postgres -k no longer works with spaces in the path murrayc@murrayc.com
  2012-09-04 14:31 ` Re: BUG #7514: postgres -k no longer works with spaces in the path Tom Lane <tgl@sss.pgh.pa.us>
  2012-09-04 18:22   ` Re: BUG #7514: postgres -k no longer works with spaces in the path Murray Cumming <murrayc@murrayc.com>
@ 2012-09-07 07:21     ` Murray Cumming <murrayc@murrayc.com>
  1 sibling, 0 replies; 8+ messages in thread

From: Murray Cumming @ 2012-09-07 07:21 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-bugs

On Tue, 2012-09-04 at 20:22 +0200, Murray Cumming wrote:
> To be honest, I don't have much interest in, or understanding of, this
> -k option anyway. I just use it because, when starting my temporary
> postgresql instance, it otherwise defaults to /var/run/postgresql/ (at
> least in this distro build) which is not available to normal users. I
> currently just specify the same directory that the postgresql data is
> in. Maybe I should just use /tmp instead.

Or would that be a security hole, allowing other users to access the
database server on multiuser systems?
 
-- 
Murray Cumming
murrayc@murrayc.com
www.murrayc.com
www.openismus.com





^ permalink  raw  reply  [nested|flat] 8+ messages in thread


end of thread, other threads:[~2012-09-07 07:21 UTC | newest]

Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2012-09-01 04:16 BUG #7514: postgres -k no longer works with spaces in the path murrayc@murrayc.com
2012-09-04 14:31 ` Tom Lane <tgl@sss.pgh.pa.us>
2012-09-04 18:22   ` Murray Cumming <murrayc@murrayc.com>
2012-09-05 22:57     ` Peter Eisentraut <peter_e@gmx.net>
2012-09-05 23:05       ` Tom Lane <tgl@sss.pgh.pa.us>
2012-09-06 00:55       ` Tom Lane <tgl@sss.pgh.pa.us>
2012-09-06 18:52         ` Robert Haas <robertmhaas@gmail.com>
2012-09-07 07:21     ` Murray Cumming <murrayc@murrayc.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox