[PATCH] virfile: Replace AbsPath judgement method with g_path_is_absolute()

Luke Yue posted 1 patch 3 years ago
Failed in applying to current master (apply log)
There is a newer version of this series
src/util/virfile.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] virfile: Replace AbsPath judgement method with g_path_is_absolute()
Posted by Luke Yue 3 years ago
The g_path_is_absolute() considers more situations
than just a simply "path[0] == '/'".

Related issue: https://gitlab.com/libvirt/libvirt/-/issues/12

Signed-off-by: Luke Yue <lukedyue@gmail.com>
---
src/util/virfile.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/util/virfile.c b/src/util/virfile.c
index 93fac200cc..3311eaff3d 100644
--- a/src/util/virfile.c
+++ b/src/util/virfile.c
@@ -3153,7 +3153,7 @@ virFileOpenTty(int *ttyprimary G_GNUC_UNUSED,
int
virFileAbsPath(const char *path, char **abspath)
{
- if (path[0] == '/') {
+ if (g_path_is_absolute(path)) {
*abspath = g_strdup(path);
} else {
g_autofree char *buf = g_get_current_dir();
-- 
2.31.1

Re: [PATCH] virfile: Replace AbsPath judgement method with g_path_is_absolute()
Posted by Martin Kletzander 3 years ago
On Tue, Mar 30, 2021 at 10:58:36PM +0800, Luke Yue wrote:
>The g_path_is_absolute() considers more situations
>than just a simply "path[0] == '/'".
>
>Related issue: https://gitlab.com/libvirt/libvirt/-/issues/12
>
>Signed-off-by: Luke Yue <lukedyue@gmail.com>
>---
>src/util/virfile.c | 2 +-
>1 file changed, 1 insertion(+), 1 deletion(-)
>

Thanks for the patch, but it is broken.  No need to worry, that's
one fo the reasons why we have this requirement.  This is not to waste
your and our time setting up e-mails later on when we're on a tight
schedule in the coding period.

I am not sure how you sent this mail, but the best way is how we
describe it Submitting Patches [0] linked to from our Contribution
Guidelines [1].  And that is using `git send-email`.  If you did send it
using that tool, then there is something else wrong which we need to fix
first.

[0] https://libvirt.org/submitting-patches.html
[1] https://libvirt.org/hacking.html

>diff --git a/src/util/virfile.c b/src/util/virfile.c
>index 93fac200cc..3311eaff3d 100644
>--- a/src/util/virfile.c
>+++ b/src/util/virfile.c
>@@ -3153,7 +3153,7 @@ virFileOpenTty(int *ttyprimary G_GNUC_UNUSED,
>int
>virFileAbsPath(const char *path, char **abspath)
>{
>- if (path[0] == '/') {
>+ if (g_path_is_absolute(path)) {
>*abspath = g_strdup(path);
>} else {
>g_autofree char *buf = g_get_current_dir();
>-- 
>2.31.1
>