zsh-workers
 help / color / mirror / code / Atom feed
* force overwrite in completions
@ 2009-02-18  8:14 Arkadiusz Miskiewicz
  2009-02-18  9:38 ` Peter Stephenson
  2009-02-18 10:11 ` Phil Pennock
  0 siblings, 2 replies; 5+ messages in thread
From: Arkadiusz Miskiewicz @ 2009-02-18  8:14 UTC (permalink / raw)
  To: zsh-workers


Hi,

I'm using zsh on a system which shares $HOME between two separate servers and 
when using both at the same time, switching to root at these (and so on) I 
sometimes get a question from mv asking me if I want to overwrite a file over 
and over.

This patch just forces such overwrite.

--- zsh-4.3.9/./Completion/compdump~    2008-07-29 10:53:08.000000000 +0200
+++ zsh-4.3.9/./Completion/compdump     2009-02-11 20:13:11.358508082 +0100
@@ -132,7 +132,7 @@
 print "typeset -gUa _comp_assocs" >> $_d_file
 print "_comp_assocs=( ${(qq)_comp_assocs} )" >> $_d_file

-mv $_d_file ${_d_file%.$HOST.$$}
+mv -f $_d_file ${_d_file%.$HOST.$$}

 unfunction compdump
 autoload -Uz compdump


-- 
Arkadiusz Miśkiewicz        PLD/Linux Team
arekm / maven.pl            http://ftp.pld-linux.org/


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

* Re: force overwrite in completions
  2009-02-18  8:14 force overwrite in completions Arkadiusz Miskiewicz
@ 2009-02-18  9:38 ` Peter Stephenson
  2009-02-18 11:07   ` Arkadiusz Miskiewicz
  2009-02-18 10:11 ` Phil Pennock
  1 sibling, 1 reply; 5+ messages in thread
From: Peter Stephenson @ 2009-02-18  9:38 UTC (permalink / raw)
  To: Arkadiusz Miskiewicz; +Cc: zsh-workers

Arkadiusz Miskiewicz wrote:
> I'm using zsh on a system which shares $HOME between two separate
> servers and when using both at the same time, switching to root at
> these (and so on) I sometimes get a question from mv asking me if I
> want to overwrite a file over and over.

Hmm.... is "mv" aliased to "mv -i"?  If so, loading compinit with
"autoload -U compinit" should stop the alias being used at this point.
I ask because if mv is aliased then adding extra options on the end of
the alias probably isn't the right fix.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


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

* Re: force overwrite in completions
  2009-02-18  8:14 force overwrite in completions Arkadiusz Miskiewicz
  2009-02-18  9:38 ` Peter Stephenson
@ 2009-02-18 10:11 ` Phil Pennock
  1 sibling, 0 replies; 5+ messages in thread
From: Phil Pennock @ 2009-02-18 10:11 UTC (permalink / raw)
  To: zsh-workers

On 2009-02-18 at 09:14 +0100, Arkadiusz Miskiewicz wrote:
> I'm using zsh on a system which shares $HOME between two separate servers and 
> when using both at the same time, switching to root at these (and so on) I 
> sometimes get a question from mv asking me if I want to overwrite a file over 
> and over.
> 
> This patch just forces such overwrite.

If the hosts have different sets of binaries installed so that
completion differs between the two, you're losing your caching as each
host keeps blowing away the other's cache.

I use this, both for NFS environment and non-NFS where I tend to play
with different versions of zsh:

if is-at-least 4.2.0; then autoload -Uz compinit ; else autoload -U compinit ; fi
[[ -d "${ZDOTDIR:-$HOME}/.zcompdumps" ]] || mkdir -m 0700 -p "${ZDOTDIR:-$HOME}/.zcompdumps"
compinit -u -d "${ZDOTDIR:-$HOME}/.zcompdumps/${HOST%%.*}-$ZSH_VERSION"

I've autoloaded is-at-least before this.

Regards,
-Phil


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

* Re: force overwrite in completions
  2009-02-18  9:38 ` Peter Stephenson
@ 2009-02-18 11:07   ` Arkadiusz Miskiewicz
  2009-02-18 11:19     ` Peter Stephenson
  0 siblings, 1 reply; 5+ messages in thread
From: Arkadiusz Miskiewicz @ 2009-02-18 11:07 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: zsh-workers

On Wednesday 18 of February 2009, Peter Stephenson wrote:
> Arkadiusz Miskiewicz wrote:
> > I'm using zsh on a system which shares $HOME between two separate
> > servers and when using both at the same time, switching to root at
> > these (and so on) I sometimes get a question from mv asking me if I
> > want to overwrite a file over and over.
>
> Hmm.... is "mv" aliased to "mv -i"?  If so, loading compinit with
> "autoload -U compinit" should stop the alias being used at this point.
> I ask because if mv is aliased then adding extra options on the end of
> the alias probably isn't the right fix.

No, it's not but somehow [1] dump file ends being created as root in user ~ 
directory and then

[arekm@tarm ~]$ LC_ALL=C mv a dump
mv: try to overwrite `dump', overriding mode 0644 (rw-r--r--)?  

[1]. sudo zsh and such usage patterns
-- 
Arkadiusz Miśkiewicz        PLD/Linux Team
arekm / maven.pl            http://ftp.pld-linux.org/


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

* Re: force overwrite in completions
  2009-02-18 11:07   ` Arkadiusz Miskiewicz
@ 2009-02-18 11:19     ` Peter Stephenson
  0 siblings, 0 replies; 5+ messages in thread
From: Peter Stephenson @ 2009-02-18 11:19 UTC (permalink / raw)
  To: Arkadiusz Miskiewicz; +Cc: zsh-workers

Arkadiusz Miskiewicz wrote:
> No, it's not but somehow [1] dump file ends being created as root in user ~
> directory

Ah, right.  I use

compinit -u -d ~/.zcompdump_${ZSH_VERSION}_$USER

to get round this but probably forcing the shell to overwrite is better
than the error.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


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

end of thread, other threads:[~2009-02-18 11:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-18  8:14 force overwrite in completions Arkadiusz Miskiewicz
2009-02-18  9:38 ` Peter Stephenson
2009-02-18 11:07   ` Arkadiusz Miskiewicz
2009-02-18 11:19     ` Peter Stephenson
2009-02-18 10:11 ` Phil Pennock

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).