RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1293276 - guestfish can not ll a symbolic link dir or edit a file in it
Summary: guestfish can not ll a symbolic link dir or edit a file in it
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libguestfs
Version: 6.8
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Pino Toscano
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks: 1301844
TreeView+ depends on / blocked
 
Reported: 2015-12-21 09:41 UTC by Xianghua Chen
Modified: 2016-05-10 19:56 UTC (History)
5 users (show)

Fixed In Version: libguestfs-1.20.11-17.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-05-10 19:56:23 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2016:0762 0 normal SHIPPED_LIVE libguestfs bug fix update 2016-05-10 22:33:40 UTC

Description Xianghua Chen 2015-12-21 09:41:27 UTC
Description of problem:
guestfish can not ll a symbolic link  dir  or edit a file in it

Version-Release number of selected component (if applicable):
libguestfs-1.20.11-16.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Prepare a image: RHEL-Server-6.7-32-hvm.raw
2. # guestfish -a RHEL-Server-6.7-32-hvm.raw -i
><fs> mkdir /home/testdir
><fs> ln-s /home/testdir/ /home/testdir_link
><fs> touch /home/testdir_link/file1
><fs> vi /home/testdir_link/file1
libguestfs: error: mv: mv: cannot stat `/sysroot/home/testdir_link/suaRydJi': No such file or directory
><fs> ll /home/testdir_link/
libguestfs: error: ll: ls: cannot access /sysroot/home/testdir_link/: No such file or directory
><fs> ll /home/testdir/
total 12
drwxr-xr-x  2 root root 4096 Dec 18 13:24 .
drwxr-xr-x. 3 root root 4096 Dec 18 13:23 ..
-rw-r--r--  1 root root   10 Dec 18 13:24 suaRydJi
-rw-r--r--  1 root root    0 Dec 18 13:23 file1



Actual results:
At step 2,
When vi the file1 , type something and save, it can not save successfully. But it will create a new file for you with the content you typed.
When ll the /home/testdir_link/, It can not list the content.

Expected results:
It can ll the symbolic link  dir and edit file1 in it.

Additional info:
1. In RHEL7.2(libguestfs-1.28.1-55.el7.x86_64) , it can edit file1 successfully, but can not ll the /home/testdir_link/ either.
2. Here is the trace log for the two command:
><fs> vi /home/testdir_link/file1
libguestfs: trace: get_tmpdir
libguestfs: trace: get_tmpdir = "/tmp"
libguestfs: trace: download "/home/testdir_link/file1" "/dev/fd/8"
libguestfs: send_to_daemon: 72 bytes: 00 00 00 44 | 20 00 f5 f5 | 00 00 00 04 | 00 00 00 43 | 00 00 00 00 | ...
libguestfs: recv_from_daemon: 40 bytes: 20 00 f5 f5 | 00 00 00 04 | 00 00 00 43 | 00 00 00 01 | 00 12 34 58 | ...
libguestfs: recv_from_daemon: 8 bytes: 00 00 00 00 | 00 00 00 00 |
libguestfs: trace: download = 0
libguestfs: trace: upload "/tmp/guestfishzuyAWL" "/home/testdir_link/suaRydJi"
libguestfs: send_to_daemon: 76 bytes: 00 00 00 48 | 20 00 f5 f5 | 00 00 00 04 | 00 00 00 42 | 00 00 00 00 | ...
libguestfs: send_to_daemon: 24 bytes: 00 00 00 14 | 00 00 00 00 | 00 00 00 0c | 6c 73 61 6a | 64 67 6c 6a | ...
libguestfs: send_to_daemon: 12 bytes: 00 00 00 08 | 00 00 00 00 | 00 00 00 00 |
libguestfs: recv_from_daemon: 40 bytes: 20 00 f5 f5 | 00 00 00 04 | 00 00 00 42 | 00 00 00 01 | 00 12 34 59 | ...
libguestfs: trace: upload = 0
libguestfs: trace: available "linuxxattrs"
libguestfs: send_to_daemon: 64 bytes: 00 00 00 3c | 20 00 f5 f5 | 00 00 00 04 | 00 00 00 d8 | 00 00 00 00 | ...
libguestfs: recv_from_daemon: 40 bytes: 20 00 f5 f5 | 00 00 00 04 | 00 00 00 d8 | 00 00 00 01 | 00 12 34 5a | ...
libguestfs: trace: available = 0
libguestfs: trace: stat "/home/testdir_link/file1"
libguestfs: send_to_daemon: 72 bytes: 00 00 00 44 | 20 00 f5 f5 | 00 00 00 04 | 00 00 00 34 | 00 00 00 00 | ...
libguestfs: recv_from_daemon: 144 bytes: 20 00 f5 f5 | 00 00 00 04 | 00 00 00 34 | 00 00 00 01 | 00 12 34 5b | ...
libguestfs: trace: stat = <struct guestfs_stat *>
libguestfs: trace: getxattr "/home/testdir_link/file1" "security.selinux"
libguestfs: send_to_daemon: 92 bytes: 00 00 00 58 | 20 00 f5 f5 | 00 00 00 04 | 00 00 01 17 | 00 00 00 00 | ...
guestfsd: error: getxattr: No data available
libguestfs: recv_from_daemon: 84 bytes: 20 00 f5 f5 | 00 00 00 04 | 00 00 01 17 | 00 00 00 01 | 00 12 34 5c | ...
libguestfs: trace: getxattr = NULL (error)
libguestfs: trace: chmod 420 "/home/testdir_link/suaRydJi"
libguestfs: send_to_daemon: 80 bytes: 00 00 00 4c | 20 00 f5 f5 | 00 00 00 04 | 00 00 00 22 | 00 00 00 00 | ...
libguestfs: recv_from_daemon: 40 bytes: 20 00 f5 f5 | 00 00 00 04 | 00 00 00 22 | 00 00 00 01 | 00 12 34 5d | ...
libguestfs: trace: chmod = 0
libguestfs: trace: chown 0 0 "/home/testdir_link/suaRydJi"
libguestfs: send_to_daemon: 84 bytes: 00 00 00 50 | 20 00 f5 f5 | 00 00 00 04 | 00 00 00 23 | 00 00 00 00 | ...
libguestfs: recv_from_daemon: 40 bytes: 20 00 f5 f5 | 00 00 00 04 | 00 00 00 23 | 00 00 00 01 | 00 12 34 5e | ...
libguestfs: trace: chown = 0
libguestfs: trace: mv "/home/testdir_link/suaRydJi" "/home/testdir_link/file1"
libguestfs: send_to_daemon: 104 bytes: 00 00 00 64 | 20 00 f5 f5 | 00 00 00 04 | 00 00 00 59 | 00 00 00 00 | ...
guestfsd: error: mv: cannot stat `/sysroot/home/testdir_link/suaRydJi': No such file or directory
libguestfs: recv_from_daemon: 128 bytes: 20 00 f5 f5 | 00 00 00 04 | 00 00 00 59 | 00 00 00 01 | 00 12 34 5f | ...
libguestfs: trace: mv = -1 (error)
libguestfs: error: mv: mv: cannot stat `/sysroot/home/testdir_link/suaRydJi': No such file or directory

><fs> ll /home/testdir_link/
libguestfs: trace: ll "/home/testdir_link/"
libguestfs: send_to_daemon: 68 bytes: 00 00 00 40 | 20 00 f5 f5 | 00 00 00 04 | 00 00 00 05 | 00 00 00 00 | ...
guestfsd: error: ls: cannot access /sysroot/home/testdir_link/: No such file or directory
libguestfs: recv_from_daemon: 120 bytes: 20 00 f5 f5 | 00 00 00 04 | 00 00 00 05 | 00 00 00 01 | 00 12 34 60 | ...
libguestfs: trace: ll = NULL (error)
libguestfs: error: ll: ls: cannot access /sysroot/home/testdir_link/: No such file or directory

Comment 1 Richard W.M. Jones 2016-01-04 13:13:33 UTC
The one line reproducers for both of these (different) problems are:

guestfish -N fs -m /dev/sda1 mkdir /dir : ln-s /dir/ /link : touch /link/file1 : vi /link/file1

guestfish -N fs -m /dev/sda1 mkdir /dir : ln-s /dir/ /link : touch /link/file1 : ll /link/

On RHEL 6.7, both commands give me errors.

Upstream, the 'vi' test is OK, but the 'll' test fails.

Comment 2 Pino Toscano 2016-01-14 16:47:52 UTC
(In reply to Richard W.M. Jones from comment #1)
> guestfish -N fs -m /dev/sda1 mkdir /dir : ln-s /dir/ /link : touch
> /link/file1 : vi /link/file1

I think this has been fixed with 431cdfd983bc9864d6a44a456a97b72455bb17cd, though that applies on the refactoring of the "edit" code (meaning this will need to be duplicated in fish/edit.c and edit/virt-edit.c).

Comment 3 Pino Toscano 2016-01-14 16:51:48 UTC
(In reply to Richard W.M. Jones from comment #1)
> guestfish -N fs -m /dev/sda1 mkdir /dir : ln-s /dir/ /link : touch
> /link/file1 : ll /link/

ll is special, as it is executed from the appliance and not from the guest -- that means absolute symlinks won't work. A fix for that could be to just resolve the path in advance, and execute ls on that instead.

Comment 6 Pino Toscano 2016-01-15 10:35:15 UTC
(In reply to Pino Toscano from comment #3)
> (In reply to Richard W.M. Jones from comment #1)
> > guestfish -N fs -m /dev/sda1 mkdir /dir : ln-s /dir/ /link : touch
> > /link/file1 : ll /link/
> 
> ll is special, as it is executed from the appliance and not from the guest
> -- that means absolute symlinks won't work. A fix for that could be to just
> resolve the path in advance, and execute ls on that instead.

Patch posted for this:
  https://www.redhat.com/archives/libguestfs/2016-January/msg00063.html

Comment 11 errata-xmlrpc 2016-05-10 19:56:23 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-0762.html


Note You need to log in before you can comment on or make changes to this bug.