[ZBX-20523] Cannot get information about symlinks to symlinks with vfs.*.get Created: 2022 Feb 02  Updated: 2024 Apr 10  Resolved: 2022 Jul 28

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Agent (G)
Affects Version/s: 6.0.0rc1
Fix Version/s: 6.0.7rc1, 6.2.1rc1, 6.4.0alpha1, 6.4 (plan)

Type: Patch request Priority: Trivial
Reporter: Marius Bakke Assignee: Andrejs Kozlovs
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File get_dir_names.patch    
Team: Team C
Sprint: Sprint 85 (Feb 2022), Sprint 86 (Mar 2022), Sprint 87 (Apr 2022), Sprint 88 (May 2022), Sprint 89 (Jun 2022), Sprint 90 (Jul 2022)
Story Points: 0.5

 Description   

Steps to reproduce:

  1. Create test directories:
    mkdir -p /tmp/{test,test-1,test-2}
    
  2. Inside /tmp/test, create symlinks:
    cd /tmp/test; ln -s ../test-1 1; ln -s ../test-2 2; ln -s 2 current
    
  3. Get the directory listing with vfs.dir.get, i.e.:
zabbix_agentd -t 'vfs.dir.get[/tmp/test]' | awk '{print $2}' | sed -e 's/^...//' -e 's/.$//' | jq .[].basename

Result:

vfs.dir.get resolves the current symlink and returns information about its target:

"test-2"
"test-1"
"test-2"

Expected:

"current"
"test-1"
"test-2"

vfs.file.get[/tmp/test/current] also returns information about test-2. There is no way to find out what current points to.



 Comments   
Comment by Marius Bakke [ 2022 Feb 02 ]

It's a somewhat contrived example, the ideal output for my case would be:

"1"
"2"
"current"

I would like to get metadata about these symlinks such as modification time.

Comment by Edgars Melveris [ 2022 Feb 04 ]

Hello Marius!
I'll confirm this to let dev team comment if this is intended. I suppose if it is, it should also be documented. Perfect solution would be if there was a parameter we could change to enable following symlinks or not.

Comment by Alexander Vladishev [ 2022 Feb 09 ]

Thank you!

vfs.dir.get and vfs.file.get should return the name and full path for the symlink in the basename, pathname and dirname parameters. This will be fixed.

Comment by Andrejs Kozlovs [ 2022 Jul 14 ]

Available in:

Comment by Andrejs Kozlovs [ 2022 Jul 26 ]

Updated documentation:

Generated at Fri Mar 21 04:22:50 EET 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.