[libvirt] [PATCHv5 02/19] util: storagefile: Introduce universal function to canonicalize paths
Eric Blake
eblake at redhat.com
Mon Jun 23 15:12:36 UTC 2014
On 06/23/2014 02:28 AM, Peter Krempa wrote:
> On 06/20/14 16:35, Eric Blake wrote:
>> On 06/19/2014 07:59 AM, Peter Krempa wrote:
>>> Introduce a common function that will take a callback to resolve links
>>> that will be used to canonicalize paths on various storage systems and
>>> add extensive tests.
>>> ---
>>> src/libvirt_private.syms | 1 +
>>> src/util/virstoragefile.c | 195 ++++++++++++++++++++++++++++++++++++++++++++++
>>> src/util/virstoragefile.h | 7 ++
>>> tests/virstoragetest.c | 108 +++++++++++++++++++++++++
>>> 4 files changed, 311 insertions(+)
>>>
>
>>
>> ACK if you can make those changes (you may want to post the interdiff)
>>
> The required changes to pass your suggested changes are:
>
> +++ b/tests/virstoragetest.c
> @@ -1154,14 +1154,14 @@ mymain(void)
> TEST_PATH_CANONICALIZE(5, "///////", "/");
> TEST_PATH_CANONICALIZE(6, "//", "//");
> TEST_PATH_CANONICALIZE(7, "", "");
> - TEST_PATH_CANONICALIZE(8, ".", "");
> + TEST_PATH_CANONICALIZE(8, ".", ".");
> TEST_PATH_CANONICALIZE(9, "../", "..");
> TEST_PATH_CANONICALIZE(10, "../../", "../..");
> TEST_PATH_CANONICALIZE(11, "../../blah", "../../blah");
> TEST_PATH_CANONICALIZE(12, "/./././blah", "/blah");
> TEST_PATH_CANONICALIZE(13, ".././../././../blah", "../../../blah");
> TEST_PATH_CANONICALIZE(14, "/././", "/");
> - TEST_PATH_CANONICALIZE(15, "./././", "");
> + TEST_PATH_CANONICALIZE(15, "./././", ".");
> TEST_PATH_CANONICALIZE(16, "blah/../foo", "foo");
> TEST_PATH_CANONICALIZE(17, "foo/bar/../blah", "foo/blah");
> TEST_PATH_CANONICALIZE(18, "foo/bar/.././blah", "foo/blah");
> @@ -1179,6 +1179,7 @@ mymain(void)
> TEST_PATH_CANONICALIZE(28, "/path/blah/yippee", "/other/path/huzah/yippee");
> TEST_PATH_CANONICALIZE(29, "/cycle", NULL);
> TEST_PATH_CANONICALIZE(30, "/cycle2/link", NULL);
> + TEST_PATH_CANONICALIZE(31, "///", "/");
Looks good. ACK to the squash-in.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140623/df872202/attachment-0001.sig>
More information about the libvir-list
mailing list