zsh-workers
 help / color / mirror / code / Atom feed
* Failing to write to history file if containing directory doesn't exist
@ 2007-10-08 10:09 Nikolai Weibull
  2007-10-08 10:15 ` Peter Stephenson
  0 siblings, 1 reply; 6+ messages in thread
From: Nikolai Weibull @ 2007-10-08 10:09 UTC (permalink / raw)
  To: zsh-workers

Zsh currently fails to write a history file if the directory
containing it doesn't exist.  Would a patch that creates the parent
directory if it doesn't exist before attempting to write to the
history file be of any interest?  I'd be willing to write such a
patch, but if this behavior is undesirable, I won't waste my time.


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

* Re: Failing to write to history file if containing directory doesn't exist
  2007-10-08 10:09 Failing to write to history file if containing directory doesn't exist Nikolai Weibull
@ 2007-10-08 10:15 ` Peter Stephenson
  2007-10-08 12:08   ` Nikolai Weibull
  0 siblings, 1 reply; 6+ messages in thread
From: Peter Stephenson @ 2007-10-08 10:15 UTC (permalink / raw)
  To: zsh-workers

"Nikolai Weibull" wrote:
> Zsh currently fails to write a history file if the directory
> containing it doesn't exist.  Would a patch that creates the parent
> directory if it doesn't exist before attempting to write to the
> history file be of any interest?  I'd be willing to write such a
> patch, but if this behavior is undesirable, I won't waste my time.

I'd have thought it was a reasonable expectation that the directory
already existed.  You can always add "mkdir -p ${HISTFILE:h}" when you
set HISTFILE, if you need to.

-- 
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] 6+ messages in thread

* Re: Failing to write to history file if containing directory doesn't exist
  2007-10-08 10:15 ` Peter Stephenson
@ 2007-10-08 12:08   ` Nikolai Weibull
  2007-10-08 13:38     ` Peter Stephenson
  0 siblings, 1 reply; 6+ messages in thread
From: Nikolai Weibull @ 2007-10-08 12:08 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: zsh-workers

On 10/8/07, Peter Stephenson <pws@csr.com> wrote:

> "Nikolai Weibull" wrote:

<rant>
Why do mail user agents still do this?  My name /is/ Nikolai Weibull.
</rant>

> > Zsh currently fails to write a history file if the directory
> > containing it doesn't exist.  Would a patch that creates the parent
> > directory if it doesn't exist before attempting to write to the
> > history file be of any interest?  I'd be willing to write such a
> > patch, but if this behavior is undesirable, I won't waste my time.

> I'd have thought it was a reasonable expectation that the directory
> already existed.  You can always add "mkdir -p ${HISTFILE:h}" when you
> set HISTFILE, if you need to.

Yes, sure, but if we assume that this isn't always the case, would
code that dealt with this case be interesting for inclusion?


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

* Re: Failing to write to history file if containing directory doesn't exist
  2007-10-08 12:08   ` Nikolai Weibull
@ 2007-10-08 13:38     ` Peter Stephenson
  2007-10-08 14:05       ` Nikolai Weibull
  0 siblings, 1 reply; 6+ messages in thread
From: Peter Stephenson @ 2007-10-08 13:38 UTC (permalink / raw)
  To: zsh-workers

Nikolai Weibull wrote:
> > I'd have thought it was a reasonable expectation that the directory
> > already existed.  You can always add "mkdir -p ${HISTFILE:h}" when you
> > set HISTFILE, if you need to.
> 
> Yes, sure, but if we assume that this isn't always the case, would
> code that dealt with this case be interesting for inclusion?

I'm frankly lukewarm about adding code for stuff that can already be
done in shell code if you need it, but if you think this is likely to
happen in practice I'll add your C code.

-- 
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] 6+ messages in thread

* Re: Failing to write to history file if containing directory doesn't exist
  2007-10-08 13:38     ` Peter Stephenson
@ 2007-10-08 14:05       ` Nikolai Weibull
  2007-10-08 14:14         ` Clint Adams
  0 siblings, 1 reply; 6+ messages in thread
From: Nikolai Weibull @ 2007-10-08 14:05 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: zsh-workers

On 10/8/07, Peter Stephenson <pws@csr.com> wrote:

> Nikolai Weibull wrote:

> > > I'd have thought it was a reasonable expectation that the directory
> > > already existed.  You can always add "mkdir -p ${HISTFILE:h}" when you
> > > set HISTFILE, if you need to.

> > Yes, sure, but if we assume that this isn't always the case, would
> > code that dealt with this case be interesting for inclusion?

> I'm frankly lukewarm about adding code for stuff that can already be
> done in shell code if you need it, but if you think this is likely to
> happen in practice I'll add your C code.

I was guessing as much.  It's not a condition that comes up often.

I discovered this "problem" when I set up a new account for myself on
a new system.  I have HISTFILE set to  "~/.local/var/lib/zsh/history"
in an attempt at making my home directory somewhat Filesystem Hierachy
Standard "compliant".  Now "~/.local/var/lib" existed, but zsh wasn't
there.  Thus Zsh failed to open the history file.

[1] http://www.pathname.com/fhs/pub/fhs-2.3.html


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

* Re: Failing to write to history file if containing directory doesn't exist
  2007-10-08 14:05       ` Nikolai Weibull
@ 2007-10-08 14:14         ` Clint Adams
  0 siblings, 0 replies; 6+ messages in thread
From: Clint Adams @ 2007-10-08 14:14 UTC (permalink / raw)
  To: zsh-workers

On Mon, Oct 08, 2007 at 04:05:58PM +0200, Nikolai Weibull wrote:
> I discovered this "problem" when I set up a new account for myself on
> a new system.  I have HISTFILE set to  "~/.local/var/lib/zsh/history"
> in an attempt at making my home directory somewhat Filesystem Hierachy
> Standard "compliant".  Now "~/.local/var/lib" existed, but zsh wasn't
> there.  Thus Zsh failed to open the history file.

Personally, I'd be a little shocked and annoyed if zsh started creating
directories without my explicit permission.


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

end of thread, other threads:[~2007-10-08 14:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-08 10:09 Failing to write to history file if containing directory doesn't exist Nikolai Weibull
2007-10-08 10:15 ` Peter Stephenson
2007-10-08 12:08   ` Nikolai Weibull
2007-10-08 13:38     ` Peter Stephenson
2007-10-08 14:05       ` Nikolai Weibull
2007-10-08 14:14         ` Clint Adams

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