[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #58547] gzip()/bzip2() do not handle relative
From: |
Rik |
Subject: |
[Octave-bug-tracker] [bug #58547] gzip()/bzip2() do not handle relative paths in first argument correctly |
Date: |
Mon, 15 Jun 2020 11:34:11 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko |
Follow-up Comment #6, bug #58547 (project octave):
"full pathname" is usually a synonym for absolute pathname.
"foo/bar" is neither relative nor absolute.
"/home/rik/foo/bar" is an example of an absolute pathname
"./foo/bar" is an example of a relative pathname
I think it is just the comment for the code that needs to be adjusted.
The code is
// Return the 'basename' of the pathname in STRING (the stuff after
// the last directory separator). If STRING is not a full pathname,
// simply return it.
std::string
env::do_base_pathname (const std::string& s) const
{
if (! (do_absolute_pathname (s) || do_rooted_relative_pathname (s)))
return s;
size_t pos = s.find_last_of (sys::file_ops::dir_sep_chars ());
if (pos == std::string::npos)
return s;
else
return s.substr (pos+1);
}
It looks to me that the first two checks, do_absolute_pathname and
do_rooted_relative_pathname) are meant to check whether the string 's' even
corresponds to a pathname. Imagine calling
do_base_pathname ("Mickey_Mouse")
This is not an absolute path, and let's assume there is no subdirectory of the
current directory named "Mickey_Mouse". In that case, both tests return
false--this is not a pathname--and the string is returned unaltered.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?58547>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #58547] gzip() does not handle relative paths in first argument correctly, anonymous, 2020/06/11
- [Octave-bug-tracker] [bug #58547] gzip() does not handle relative paths in first argument correctly, Kai Torben Ohlhus, 2020/06/12
- [Octave-bug-tracker] [bug #58547] gzip() does not handle relative paths in first argument correctly, anonymous, 2020/06/12
- [Octave-bug-tracker] [bug #58547] gzip()/bzip2() do not handle relative paths in first argument correctly, Rik, 2020/06/13
- [Octave-bug-tracker] [bug #58547] gzip()/bzip2() do not handle relative paths in first argument correctly, Kai Torben Ohlhus, 2020/06/14
- [Octave-bug-tracker] [bug #58547] gzip()/bzip2() do not handle relative paths in first argument correctly, Carnë Draug, 2020/06/15
- [Octave-bug-tracker] [bug #58547] gzip()/bzip2() do not handle relative paths in first argument correctly,
Rik <=
- [Octave-bug-tracker] [bug #58547] gzip()/bzip2() do not handle relative paths in first argument correctly, Carnë Draug, 2020/06/16
- [Octave-bug-tracker] [bug #58547] gzip()/bzip2() do not handle relative paths in first argument correctly, Rik, 2020/06/16
- [Octave-bug-tracker] [bug #58547] gzip()/bzip2() do not handle relative paths in first argument correctly, John W. Eaton, 2020/06/16