all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH cluster] fix #6445: correctly set size when stat-ing symlinks
@ 2025-06-06  8:50 Fabian Grünbichler
  2025-06-25 14:50 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Fabian Grünbichler @ 2025-06-06  8:50 UTC (permalink / raw)
  To: pve-devel

the size of a symlink should be the length of its target, some tools like
bsdtar seem to actually rely on this information for allocating buffers..

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---

Notes:
    should apply to master and stable-bookworm, and can IMHO go into both..

 src/pmxcfs/cfs-plug-link.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/pmxcfs/cfs-plug-link.c b/src/pmxcfs/cfs-plug-link.c
index d4eedfc..573db4d 100644
--- a/src/pmxcfs/cfs-plug-link.c
+++ b/src/pmxcfs/cfs-plug-link.c
@@ -55,8 +55,16 @@ static int cfs_plug_link_getattr(cfs_plug_t *plug, const char *path, struct stat
 
     cfs_debug("enter cfs_plug_link_getattr %s", path);
 
+    int ret = -EACCES;
+
+    cfs_plug_link_t *lnk = (cfs_plug_link_t *)plug;
+    if (!lnk->symlink) {
+        goto ret;
+    }
+
     memset(stbuf, 0, sizeof(struct stat));
 
+    stbuf->st_size = strlen(lnk->symlink);
     if (cfs_is_quorate()) {
         stbuf->st_mode = S_IFLNK | 0777;
     } else {
@@ -65,7 +73,10 @@ static int cfs_plug_link_getattr(cfs_plug_t *plug, const char *path, struct stat
 
     stbuf->st_nlink = 1;
 
-    return 0;
+    ret = 0;
+
+ret:
+    return ret;
 }
 
 static int cfs_plug_link_readlink(cfs_plug_t *plug, const char *path, char *buf, size_t max) {
-- 
2.39.5



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

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

* [pve-devel] applied: [PATCH cluster] fix #6445: correctly set size when stat-ing symlinks
  2025-06-06  8:50 [pve-devel] [PATCH cluster] fix #6445: correctly set size when stat-ing symlinks Fabian Grünbichler
@ 2025-06-25 14:50 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2025-06-25 14:50 UTC (permalink / raw)
  To: pve-devel, Fabian Grünbichler

On Fri, 06 Jun 2025 10:50:49 +0200, Fabian Grünbichler wrote:
> the size of a symlink should be the length of its target, some tools like
> bsdtar seem to actually rely on this information for allocating buffers..
> 
> 

Applied, with commit message reflowed to match our preferred column width,
thanks!

[1/1] fix #6445: correctly set size when stat-ing symlinks
      commit: 477678d517ec5b25da0f26881cd0512e4352432f


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

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

end of thread, other threads:[~2025-06-25 14:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-06  8:50 [pve-devel] [PATCH cluster] fix #6445: correctly set size when stat-ing symlinks Fabian Grünbichler
2025-06-25 14:50 ` [pve-devel] applied: " Thomas Lamprecht

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal