You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by Alan Conway <ac...@redhat.com> on 2013/12/04 23:06:49 UTC

Review Request 16018: QPID-5307: Added portable Path, check for isAbsolute()

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/16018/
-----------------------------------------------------------

Review request for qpid, Andrew Stitcher and Steve Huston.


Bugs: QPID-5307
    https://issues.apache.org/jira/browse/QPID-5307


Repository: qpid


Description
-------

QPID-5307: Added portable Path, check for isAbsolute()

qpid::sys::Path provides some basic operations on path names,
with implementations for posix and windows.

Needed by work on a portable test system.


Diffs
-----

  /trunk/qpid/cpp/src/CMakeLists.txt 1546628 
  /trunk/qpid/cpp/src/qpid/acl/AclPlugin.cpp 1546628 
  /trunk/qpid/cpp/src/qpid/sys/Path.h PRE-CREATION 
  /trunk/qpid/cpp/src/qpid/sys/posix/Path.cpp PRE-CREATION 
  /trunk/qpid/cpp/src/qpid/sys/windows/Path.cpp PRE-CREATION 

Diff: https://reviews.apache.org/r/16018/diff/


Testing
-------


Thanks,

Alan Conway


Re: Review Request 16018: QPID-5307: Added portable Path, check for isAbsolute()

Posted by Alan Conway <ac...@redhat.com>.

> On Dec. 4, 2013, 10:18 p.m., Andrew Stitcher wrote:
> > I can see no actual justification for this change in either the review comments or the refered bug:
> > 
> > There is nothing per se wrong with this change, I just don't really understand why it necessary.
> > 
> > Incidentally '/' works perfectly well as a path separator on windows too (even if it is not the default). It is true that the test for an absolute path would be different though.
> >

It's required because AclPlugin falls over if you give it an aclFile of the form c:\path\to\aclfile. It currently tests for absolute path with path[0]=='/'.
The rest of Path is not immediately essential but I though we could use a place to collect other path-related portability fixes in the future. I looked at FileSysDir but it's quite specifically for directories. We could refactor FileSysDir as a subclass of Path if you think that's worthwhile.

This came up in the context of work on portable python-based tests, but I wanted to separate this out because it stands alone. I can create another bug for it if need be.


> On Dec. 4, 2013, 10:18 p.m., Andrew Stitcher wrote:
> > /trunk/qpid/cpp/src/qpid/acl/AclPlugin.cpp, line 75
> > <https://reviews.apache.org/r/16018/diff/1/?file=394139#file394139line75>
> >
> >     "aclFile+dataDir" looks backwards. Even this is actually correct it is going to cause confusion.

aclFile+dataDir is backwards! good catch, will fix that.


- Alan


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/16018/#review29765
-----------------------------------------------------------


On Dec. 4, 2013, 10:06 p.m., Alan Conway wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/16018/
> -----------------------------------------------------------
> 
> (Updated Dec. 4, 2013, 10:06 p.m.)
> 
> 
> Review request for qpid, Andrew Stitcher and Steve Huston.
> 
> 
> Bugs: QPID-5307
>     https://issues.apache.org/jira/browse/QPID-5307
> 
> 
> Repository: qpid
> 
> 
> Description
> -------
> 
> QPID-5307: Added portable Path, check for isAbsolute()
> 
> qpid::sys::Path provides some basic operations on path names,
> with implementations for posix and windows.
> 
> Needed by work on a portable test system.
> 
> 
> Diffs
> -----
> 
>   /trunk/qpid/cpp/src/CMakeLists.txt 1546628 
>   /trunk/qpid/cpp/src/qpid/acl/AclPlugin.cpp 1546628 
>   /trunk/qpid/cpp/src/qpid/sys/Path.h PRE-CREATION 
>   /trunk/qpid/cpp/src/qpid/sys/posix/Path.cpp PRE-CREATION 
>   /trunk/qpid/cpp/src/qpid/sys/windows/Path.cpp PRE-CREATION 
> 
> Diff: https://reviews.apache.org/r/16018/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Alan Conway
> 
>


Re: Review Request 16018: QPID-5307: Added portable Path, check for isAbsolute()

Posted by Andrew Stitcher <as...@apache.org>.

> On Dec. 4, 2013, 10:18 p.m., Andrew Stitcher wrote:
> > I can see no actual justification for this change in either the review comments or the refered bug:
> > 
> > There is nothing per se wrong with this change, I just don't really understand why it necessary.
> > 
> > Incidentally '/' works perfectly well as a path separator on windows too (even if it is not the default). It is true that the test for an absolute path would be different though.
> >
> 
> Alan Conway wrote:
>     It's required because AclPlugin falls over if you give it an aclFile of the form c:\path\to\aclfile. It currently tests for absolute path with path[0]=='/'.
>     The rest of Path is not immediately essential but I though we could use a place to collect other path-related portability fixes in the future. I looked at FileSysDir but it's quite specifically for directories. We could refactor FileSysDir as a subclass of Path if you think that's worthwhile.
>     
>     This came up in the context of work on portable python-based tests, but I wanted to separate this out because it stands alone. I can create another bug for it if need be.

I think a new bug is definitely required. In fact I'd go so far as to say this is a very serious defect. in the code we are about to release (and have released come to that).


- Andrew


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/16018/#review29765
-----------------------------------------------------------


On Dec. 4, 2013, 10:06 p.m., Alan Conway wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/16018/
> -----------------------------------------------------------
> 
> (Updated Dec. 4, 2013, 10:06 p.m.)
> 
> 
> Review request for qpid, Andrew Stitcher and Steve Huston.
> 
> 
> Bugs: QPID-5307
>     https://issues.apache.org/jira/browse/QPID-5307
> 
> 
> Repository: qpid
> 
> 
> Description
> -------
> 
> QPID-5307: Added portable Path, check for isAbsolute()
> 
> qpid::sys::Path provides some basic operations on path names,
> with implementations for posix and windows.
> 
> Needed by work on a portable test system.
> 
> 
> Diffs
> -----
> 
>   /trunk/qpid/cpp/src/CMakeLists.txt 1546628 
>   /trunk/qpid/cpp/src/qpid/acl/AclPlugin.cpp 1546628 
>   /trunk/qpid/cpp/src/qpid/sys/Path.h PRE-CREATION 
>   /trunk/qpid/cpp/src/qpid/sys/posix/Path.cpp PRE-CREATION 
>   /trunk/qpid/cpp/src/qpid/sys/windows/Path.cpp PRE-CREATION 
> 
> Diff: https://reviews.apache.org/r/16018/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Alan Conway
> 
>


Re: Review Request 16018: QPID-5307: Added portable Path, check for isAbsolute()

Posted by Andrew Stitcher <as...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/16018/#review29765
-----------------------------------------------------------


I can see no actual justification for this change in either the review comments or the refered bug:

There is nothing per se wrong with this change, I just don't really understand why it necessary.

Incidentally '/' works perfectly well as a path separator on windows too (even if it is not the default). It is true that the test for an absolute path would be different though.



/trunk/qpid/cpp/src/qpid/acl/AclPlugin.cpp
<https://reviews.apache.org/r/16018/#comment57241>

    "aclFile+dataDir" looks backwards. Even this is actually correct it is going to cause confusion.


- Andrew Stitcher


On Dec. 4, 2013, 10:06 p.m., Alan Conway wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/16018/
> -----------------------------------------------------------
> 
> (Updated Dec. 4, 2013, 10:06 p.m.)
> 
> 
> Review request for qpid, Andrew Stitcher and Steve Huston.
> 
> 
> Bugs: QPID-5307
>     https://issues.apache.org/jira/browse/QPID-5307
> 
> 
> Repository: qpid
> 
> 
> Description
> -------
> 
> QPID-5307: Added portable Path, check for isAbsolute()
> 
> qpid::sys::Path provides some basic operations on path names,
> with implementations for posix and windows.
> 
> Needed by work on a portable test system.
> 
> 
> Diffs
> -----
> 
>   /trunk/qpid/cpp/src/CMakeLists.txt 1546628 
>   /trunk/qpid/cpp/src/qpid/acl/AclPlugin.cpp 1546628 
>   /trunk/qpid/cpp/src/qpid/sys/Path.h PRE-CREATION 
>   /trunk/qpid/cpp/src/qpid/sys/posix/Path.cpp PRE-CREATION 
>   /trunk/qpid/cpp/src/qpid/sys/windows/Path.cpp PRE-CREATION 
> 
> Diff: https://reviews.apache.org/r/16018/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Alan Conway
> 
>


Re: Review Request 16018: QPID-5398: qpidd --acl-file does not work with a drive-prefixed path on windows.

Posted by Alan Conway <ac...@redhat.com>.

> On Dec. 5, 2013, 8:20 p.m., Andrew Stitcher wrote:
> > /trunk/qpid/cpp/src/qpid/sys/posix/Path.cpp, line 40
> > <https://reviews.apache.org/r/16018/diff/2/?file=394493#file394493line40>
> >
> >     Being nitpicky:
> >     
> >     I think it's more usual to have a message like:
> >     
> >     <context info>: strerror(errno)
> >     (certainly perror() does this)
> >     
> >     Also "invalid path" is ambiguous, how about:
> >     
> >     string("stat() failed: ") + path + ": " + strError(errno)
> >     
> >     [And also for the windows version]

done.


- Alan


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/16018/#review29831
-----------------------------------------------------------


On Dec. 5, 2013, 8:11 p.m., Alan Conway wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/16018/
> -----------------------------------------------------------
> 
> (Updated Dec. 5, 2013, 8:11 p.m.)
> 
> 
> Review request for qpid, Andrew Stitcher, Justin Ross, and Steve Huston.
> 
> 
> Bugs: QPID-5307
>     https://issues.apache.org/jira/browse/QPID-5307
> 
> 
> Repository: qpid
> 
> 
> Description
> -------
> 
> QPID-5398: qpidd --acl-file does not work with a drive-prefixed path on windows.
> 
> On windows, acl-file was not recognizing drive-prefixed paths (e.g. c:\foo)
> as absolute and was trying to interpret them relative to the brokers data-dir.
> 
> This commit fixes the problem and adds a general-purpose Path class that can be
> a collection point for any other path-related portability problems that come up.
> 
> 
> Diffs
> -----
> 
>   /trunk/qpid/cpp/src/CMakeLists.txt 1548180 
>   /trunk/qpid/cpp/src/qpid/acl/AclPlugin.cpp 1548180 
>   /trunk/qpid/cpp/src/qpid/sys/Path.h PRE-CREATION 
>   /trunk/qpid/cpp/src/qpid/sys/posix/Path.cpp PRE-CREATION 
>   /trunk/qpid/cpp/src/qpid/sys/windows/Path.cpp PRE-CREATION 
> 
> Diff: https://reviews.apache.org/r/16018/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Alan Conway
> 
>


Re: Review Request 16018: QPID-5398: qpidd --acl-file does not work with a drive-prefixed path on windows.

Posted by Andrew Stitcher <as...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/16018/#review29831
-----------------------------------------------------------

Ship it!


Except for the nit picking below this is good to go


/trunk/qpid/cpp/src/qpid/sys/posix/Path.cpp
<https://reviews.apache.org/r/16018/#comment57309>

    Being nitpicky:
    
    I think it's more usual to have a message like:
    
    <context info>: strerror(errno)
    (certainly perror() does this)
    
    Also "invalid path" is ambiguous, how about:
    
    string("stat() failed: ") + path + ": " + strError(errno)
    
    [And also for the windows version]


- Andrew Stitcher


On Dec. 5, 2013, 8:11 p.m., Alan Conway wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/16018/
> -----------------------------------------------------------
> 
> (Updated Dec. 5, 2013, 8:11 p.m.)
> 
> 
> Review request for qpid, Andrew Stitcher, Justin Ross, and Steve Huston.
> 
> 
> Bugs: QPID-5307
>     https://issues.apache.org/jira/browse/QPID-5307
> 
> 
> Repository: qpid
> 
> 
> Description
> -------
> 
> QPID-5398: qpidd --acl-file does not work with a drive-prefixed path on windows.
> 
> On windows, acl-file was not recognizing drive-prefixed paths (e.g. c:\foo)
> as absolute and was trying to interpret them relative to the brokers data-dir.
> 
> This commit fixes the problem and adds a general-purpose Path class that can be
> a collection point for any other path-related portability problems that come up.
> 
> 
> Diffs
> -----
> 
>   /trunk/qpid/cpp/src/CMakeLists.txt 1548180 
>   /trunk/qpid/cpp/src/qpid/acl/AclPlugin.cpp 1548180 
>   /trunk/qpid/cpp/src/qpid/sys/Path.h PRE-CREATION 
>   /trunk/qpid/cpp/src/qpid/sys/posix/Path.cpp PRE-CREATION 
>   /trunk/qpid/cpp/src/qpid/sys/windows/Path.cpp PRE-CREATION 
> 
> Diff: https://reviews.apache.org/r/16018/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Alan Conway
> 
>


Re: Review Request 16018: QPID-5398: qpidd --acl-file does not work with a drive-prefixed path on windows.

Posted by Alan Conway <ac...@redhat.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/16018/
-----------------------------------------------------------

(Updated Dec. 5, 2013, 8:11 p.m.)


Review request for qpid, Andrew Stitcher, Justin Ross, and Steve Huston.


Changes
-------

Made this a separte JIRA and fixed the problem Andrew pointed out. I'd like to put this in 0.26.


Summary (updated)
-----------------

QPID-5398: qpidd --acl-file does not work with a drive-prefixed path on windows.


Bugs: QPID-5307
    https://issues.apache.org/jira/browse/QPID-5307


Repository: qpid


Description (updated)
-------

QPID-5398: qpidd --acl-file does not work with a drive-prefixed path on windows.

On windows, acl-file was not recognizing drive-prefixed paths (e.g. c:\foo)
as absolute and was trying to interpret them relative to the brokers data-dir.

This commit fixes the problem and adds a general-purpose Path class that can be
a collection point for any other path-related portability problems that come up.


Diffs (updated)
-----

  /trunk/qpid/cpp/src/CMakeLists.txt 1548180 
  /trunk/qpid/cpp/src/qpid/acl/AclPlugin.cpp 1548180 
  /trunk/qpid/cpp/src/qpid/sys/Path.h PRE-CREATION 
  /trunk/qpid/cpp/src/qpid/sys/posix/Path.cpp PRE-CREATION 
  /trunk/qpid/cpp/src/qpid/sys/windows/Path.cpp PRE-CREATION 

Diff: https://reviews.apache.org/r/16018/diff/


Testing
-------


Thanks,

Alan Conway


Re: Review Request 16018: QPID-5307: Added portable Path, check for isAbsolute()

Posted by Steve Huston <sh...@riverace.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/16018/#review29780
-----------------------------------------------------------

Ship it!


Ship It!

- Steve Huston


On Dec. 4, 2013, 10:06 p.m., Alan Conway wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/16018/
> -----------------------------------------------------------
> 
> (Updated Dec. 4, 2013, 10:06 p.m.)
> 
> 
> Review request for qpid, Andrew Stitcher and Steve Huston.
> 
> 
> Bugs: QPID-5307
>     https://issues.apache.org/jira/browse/QPID-5307
> 
> 
> Repository: qpid
> 
> 
> Description
> -------
> 
> QPID-5307: Added portable Path, check for isAbsolute()
> 
> qpid::sys::Path provides some basic operations on path names,
> with implementations for posix and windows.
> 
> Needed by work on a portable test system.
> 
> 
> Diffs
> -----
> 
>   /trunk/qpid/cpp/src/CMakeLists.txt 1546628 
>   /trunk/qpid/cpp/src/qpid/acl/AclPlugin.cpp 1546628 
>   /trunk/qpid/cpp/src/qpid/sys/Path.h PRE-CREATION 
>   /trunk/qpid/cpp/src/qpid/sys/posix/Path.cpp PRE-CREATION 
>   /trunk/qpid/cpp/src/qpid/sys/windows/Path.cpp PRE-CREATION 
> 
> Diff: https://reviews.apache.org/r/16018/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Alan Conway
> 
>