<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi Nikolay,</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
We use guestfish, so I preferred to use commands supported by guestfish.</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I tried as below but "realpath" is not working after I have the target path from symlink.</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
--> Check if the path has a symlink.</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
is-symlink path</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Ex. - is-symlink "/etc/resolv.conf"   -> return true</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
--> If it's true then get target link path</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
readlink path</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
ex. - readlink "/etc/resolv.conf"  --> return "<span style="background-color: rgb(255, 255, 0);">../</span>run/systemd/resolve/stub-resolv.conf"</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
--> Which return's target path but it's not a full path, so needs to get full path to access the target file. </div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Tried to use realpath as below using target path from above return but it's giving None</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
ex. - realpath "<span style="margin: 0px; font-family: Calibri, Helvetica, sans-serif; background-color: rgb(255, 255, 0)">../</span><span style="font-family: Calibri, Helvetica, sans-serif; background-color: rgb(255, 255, 255); display: inline !important">run/systemd/resolve/stub-resolv.conf</span>" 
 --> return None</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Can you tell me how can I get the real path as without the fu<span style="font-family: calibri, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0);">ll </span><span style="font-family: calibri, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0); display: inline !important;">canonicalized
 absolute path I can't do anything with that file.</span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-family: "Times New Roman"; font-size: medium; display: inline !important"><br>
</span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-family: "Times New Roman"; font-size: medium; display: inline !important"><br>
</span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-family: calibri, helvetica, sans-serif; font-size: 12pt; display: inline !important; color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0);">Thanks,</span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-family: calibri, helvetica, sans-serif; font-size: 12pt; display: inline !important; color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0);">Chintan</span></div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> libguestfs-bounces@redhat.com <libguestfs-bounces@redhat.com> on behalf of Nikolay Ivanets <stenavin@gmail.com><br>
<b>Sent:</b> Friday, June 28, 2019 2:00 AM<br>
<b>To:</b> Chintan Patel<br>
<b>Cc:</b> libguestfs@redhat.com<br>
<b>Subject:</b> Re: [Libguestfs] Guestfish command - "copy-out" not working for symbolic links</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">If it is one time operation you can call 'realpath'<br>
(<a href="http://libguestfs.org/guestfs.3.html#guestfs_realpath">http://libguestfs.org/guestfs.3.html#guestfs_realpath</a>) first to<br>
resolve symlink.<br>
<br>
--<br>
    +380979184774<br>
    Mykola Ivanets<br>
<br>
ïò, 28 ÷åðâ. 2019 î 11:11 Chintan Patel <Chintan.Patel@microsoft.com> ïèøå:<br>
><br>
> HI,<br>
><br>
> I’m trying to use copu-out command to copy files from remote disk but it’s not working if the file is symbolic link.<br>
><br>
> copy-out giving an error like below.<br>
> libguestfs: error: ‘/etc/resolv.conf’ is not a file or directory<br>
> This file is there but it's a symbolic link<br>
><br>
> Do you have any other way to copy remote symbolic link files?<br>
><br>
> Thanks,<br>
><br>
> Chintan<br>
><br>
> _______________________________________________<br>
> Libguestfs mailing list<br>
> Libguestfs@redhat.com<br>
> <a href="https://www.redhat.com/mailman/listinfo/libguestfs">https://www.redhat.com/mailman/listinfo/libguestfs</a><br>
<br>
_______________________________________________<br>
Libguestfs mailing list<br>
Libguestfs@redhat.com<br>
<a href="https://www.redhat.com/mailman/listinfo/libguestfs">https://www.redhat.com/mailman/listinfo/libguestfs</a></div>
</span></font></div>
</body>
</html>