From: Akio Takebe Subject: Re: [Patch] fix canonicalize-existing vbd file Date: Wed, 05 Dec 2007 23:57:50 +0900 Message-ID: <4C8374F34D97Ftakebe_akio@jp.fujitsu.com> References: <2C83747DEF0A9takebe_akio@jp.fujitsu.com> <18262.46378.207517.51816@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Boundary-uLhTFmKrlRcBMsAiTrlXi" Return-path: In-Reply-To: <18262.46378.207517.51816@mariner.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Ian Jackson , Keir Fraser Cc: xen-devel , Akio Takebe List-Id: xen-devel@lists.xenproject.org --Boundary-uLhTFmKrlRcBMsAiTrlXi Content-Type: text/plain; charset=iso-2022-jp Content-Transfer-Encoding: 7bit Content-Description: Mail message body Hi, Keir and Ian Thank you, Ian. How about the attached new patch? Signed-off-by: Akio Takebe Best Regards, Akio Takebe >Keir Fraser writes ("Re: [Xen-devel] [Patch] fix canonicalize-existing vbd >file"): >> Do you mean to 'test -f "$file"'? A symlink will always fail 'test -f', and >> $p can be a symlink. > >test -f calls stat(2) rather than lstat(2) and only falls back to the >latter if the former fails. So if the argument is a link which can be >dereferenced, test -f tells you whether the link target is a file. > >If you want to know whether $file is a file or a symlink to a file > test -f "$file" >precisely wrong as it is true in both those cases. > >See > http://www.opengroup.org/onlinepubs/009695399/utilities/test.html >which says > With the exception of the -h file and -L file primaries, if a > file argument is a symbolic link, test shall evaluate the > expression by resolving the symbolic link and using the file > referenced by the link. > >It's actually true, too: > >mariner:~/junk> touch a >mariner:~/junk> ln -s a b >mariner:~/junk> test -f a && echo file >file >mariner:~/junk> test -f b && echo file >file >mariner:~/junk> test -L b && echo link >link >mariner:~/junk> ln -s enoent c >mariner:~/junk> test -f c && echo file >mariner:~/junk> test -L c && echo link >link >mariner:~/junk> > >Ian. --Boundary-uLhTFmKrlRcBMsAiTrlXi Content-Type: application/octet-stream; name="fix_check-existing_vbd_file.v2.patch" Content-Disposition: attachment; filename="fix_check-existing_vbd_file.v2.patch" Content-Transfer-Encoding: base64 ZGlmZiAtciAzMDU3ZjgxM2RhMTQgdG9vbHMvZXhhbXBsZXMvYmxvY2sKLS0tIGEvdG9vbHMv ZXhhbXBsZXMvYmxvY2sJVGh1IE5vdiAyOSAxOTozMDozMyAyMDA3ICswMDAwCisrKyBiL3Rv b2xzL2V4YW1wbGVzL2Jsb2NrCVdlZCBEZWMgMDUgMjM6NTY6MDMgMjAwNyArMDkwMApAQCAt MjIwLDYgKzIyMCw3IEBAIGNhc2UgIiRjb21tYW5kIiBpbgogICAgICAgICAjIENhbm9uaWNh bGlzZSB0aGUgZmlsZSwgZm9yIHNoYXJpbmcgY2hlY2sgY29tcGFyaXNvbiwgYW5kIHRoZSBt b2RlCiAgICAgICAgICMgZm9yIGVhc2Ugb2YgdXNlIGhlcmUuCiAgICAgICAgIGZpbGU9JChy ZWFkbGluayAtZiAiJHAiKSB8fCBmYXRhbCAiJHAgZG9lcyBub3QgZXhpc3QuIgorICAgICAg ICB0ZXN0IC1mICIkZmlsZSIgfHwgZmF0YWwgIiRmaWxlIGRvZXMgbm90IGV4aXN0LiIKICAg ICAgICAgbW9kZT0kKGNhbm9uaWNhbGlzZV9tb2RlICIkbW9kZSIpCiAKICAgICAgICAgY2xh aW1fbG9jayAiYmxvY2siCg== --Boundary-uLhTFmKrlRcBMsAiTrlXi Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --Boundary-uLhTFmKrlRcBMsAiTrlXi--