Re: symlinks, lstat, relative/absolute combos
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=MDprEJungtZTVATEwuIncWjEp3qNOx2NoO/WNEI5hw8=; b=cIZqawW3fC/OTTd1UQthPlKzgur9G7lG8JWJm/rA32yXHG+mpwA2Q0ofkGI9Y/PZbY pTMKRx/8Lh9T+aQM92Yp3TBtTd0PaFmy4EdaLjk75941TjkAR9ab/obkjDWUzA94MbHW 22d+rvcr/QFrXclMS5DObIIdOIiLJWBPAIYKU= Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=QThMbuunvachZD/1QWeqodY8REA5i+qcrSBM+zPoO5PoQDyHd5qrucEQFaKrxlccR3 vdmpWvIukrxiOZGrOowSJ25IC4mHUaajCbSbOQdjx+MhlWQqEi+fQN0Xadk+2X9zhyMO O7yVxTEoyo2pKPK8pyz0z+b32YYD0uogH9RQo= On 22 March 2011 06:08, Steven Abner <pheonix@zoomtown.com> wrote:
Hi , I was working on Mac symlinks(unix style) and encountered things I couldn't find information on through web searches. I was thinking these are Mac specific flags and meanings, so with that intro: when you lstat() a symlink, lstat states that st_size will be the size of the pathname for the link, what does it mean when it is a link with st_size = 0, yet it does have a link?
I believe that the st_size of a symlink is a filesystem implementation detail. You should not rely on it for anything serious.
And what is the special meaning of a return when it mixes relative paths with absolute paths? Example: a return of ../..//System . Should "../../" be ignored and jump to System directory of of root? Or is "/" before "System" suppose to mean ignore me please? Currently my code just returns "//" is an error.
No. Any number of '/' characters is legal and is the same as a single '/'. Any number of '/./' path components is also legal and is also the same so a single '/'.
As I read it: from here (relative path) go to parent (..), from here (/) go to parent (..) from here (/) go to (/System). Or is "//" an abbreviated "/./" , which currently seems unsupported?
So to process the path "../..//System", take the current working directory, go back one path component for each ".." component, then append one component named "System". Wherever you end up after that is the right place. Note that the path "/../../.." resolves to just "/". That is, the parent directory of "/" is "/". You can trivially demonstrate this my doing "cd /../../../../." -- James Peach | jorgar@gmail.com _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com
participants (1)
-
James Peach