zsh-users
 help / color / mirror / code / Atom feed
* Completion: smarter symlink completion
@ 2013-03-06 15:07 Ramkumar Ramachandra
  2013-03-06 15:52 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Ramkumar Ramachandra @ 2013-03-06 15:07 UTC (permalink / raw)
  To: zsh-users

Hi,

I noticed that symlinks are always completed with the trailing slash,
like directories, and unlike normal files.  This can be problematic if
the user runs `rm -r` on a symlink by mistake.  Is this really a bug,
or am I misunderstanding something?

Thanks.

Ram

p.s- Please CC me on replies, as I'm not subscribed to the list.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Completion: smarter symlink completion
  2013-03-06 15:07 Completion: smarter symlink completion Ramkumar Ramachandra
@ 2013-03-06 15:52 ` Bart Schaefer
  2013-03-06 16:28   ` Ramkumar Ramachandra
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2013-03-06 15:52 UTC (permalink / raw)
  To: Ramkumar Ramachandra, zsh-users

On Mar 6,  8:37pm, Ramkumar Ramachandra wrote:
}
} I noticed that symlinks are always completed with the trailing slash

I presume you mean symlinks whose targets are directories?  If symlinks
whose targets are files are getting a trailing slash, that would clearly
be strange.

} like directories, and unlike normal files.  This can be problematic if
} the user runs `rm -r` on a symlink by mistake.

Does autoremoveslash not take the slash away again before the command
is executed?  It certainly does for me.

In any case I'd say running rm -r by mistake is a problem independent of
how the file name was completed.  If you have a rash of people running
rm -r accidentally, why aren't you worried about real directories?

} Is this really a bug, or am I misunderstanding something?

The assumption is that when completing a directory (whether symlink
or not), there's every likelyhood that the directory itself is not the
end result, and you're going to continue completing other files down
the tree.  The slash is appended to (a) make that obvious and (b) not
require that you switch back and forth between TAB and / keys in order
to continue completing (unless the directory name itself was part of
an ambiguous list).


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Completion: smarter symlink completion
  2013-03-06 15:52 ` Bart Schaefer
@ 2013-03-06 16:28   ` Ramkumar Ramachandra
  0 siblings, 0 replies; 3+ messages in thread
From: Ramkumar Ramachandra @ 2013-03-06 16:28 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-users

Bart Schaefer wrote:
> On Mar 6,  8:37pm, Ramkumar Ramachandra wrote:
> }
> } I noticed that symlinks are always completed with the trailing slash
>
> I presume you mean symlinks whose targets are directories?  If symlinks
> whose targets are files are getting a trailing slash, that would clearly
> be strange.
>
> } like directories, and unlike normal files.  This can be problematic if
> } the user runs `rm -r` on a symlink by mistake.
>
> Does autoremoveslash not take the slash away again before the command
> is executed?  It certainly does for me.

AUTO_REMOVE_SLASH works, thanks.

> In any case I'd say running rm -r by mistake is a problem independent of
> how the file name was completed.  If you have a rash of people running
> rm -r accidentally, why aren't you worried about real directories?

Agreed.  I crafted the problem mostly out of theoretical interest; it
doesn't arise from a real-world itch.

> } Is this really a bug, or am I misunderstanding something?
>
> The assumption is that when completing a directory (whether symlink
> or not), there's every likelyhood that the directory itself is not the
> end result, and you're going to continue completing other files down
> the tree.  The slash is appended to (a) make that obvious and (b) not
> require that you switch back and forth between TAB and / keys in order
> to continue completing (unless the directory name itself was part of
> an ambiguous list).

Makes sense, thanks.  Yes, I'd want zsh to follow symlinks and operate
on the tree of the underlying directory.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-03-06 16:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-06 15:07 Completion: smarter symlink completion Ramkumar Ramachandra
2013-03-06 15:52 ` Bart Schaefer
2013-03-06 16:28   ` Ramkumar Ramachandra

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).