* mintty --log overwrites existing logfile in place
@ 2011-08-04 9:57 Christian Franke
2011-08-05 20:39 ` Andy Koppe
0 siblings, 1 reply; 5+ messages in thread
From: Christian Franke @ 2011-08-04 9:57 UTC (permalink / raw)
To: cygwin
The mintty --log option is very useful but opens logfile without O_TRUNC
or O_APPEND:
mintty-1.0.1/child.c:
// Open log file if any
if (*cfg.log) {
log_fd = open(cfg.log, O_WRONLY | O_CREAT, 0600);
if (log_fd < 0)
error("open log file");
}
Then it is sometimes difficult to determine where the new log output
ends :-)
I would suggest to add O_APPEND.
Thanks,
Christian
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: mintty --log overwrites existing logfile in place
2011-08-04 9:57 mintty --log overwrites existing logfile in place Christian Franke
@ 2011-08-05 20:39 ` Andy Koppe
2011-08-06 9:03 ` Csaba Raduly
0 siblings, 1 reply; 5+ messages in thread
From: Andy Koppe @ 2011-08-05 20:39 UTC (permalink / raw)
To: Christian Franke, cygwin
On 4 August 2011 10:57, Christian Franke wrote:
> The mintty --log option is very useful but opens logfile without O_TRUNC
> or O_APPEND:
D'oh!
> mintty-1.0.1/child.c:
> // Open log file if any
> if (*cfg.log) {
> log_fd = open(cfg.log, O_WRONLY | O_CREAT, 0600);
> if (log_fd < 0)
> error("open log file");
> }
>
> Then it is sometimes difficult to determine where the new log output
> ends :-)
>
> I would suggest to add O_APPEND.
I'll ponder that. The original intention was O_TRUNC.
Thanks,
Andy
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: mintty --log overwrites existing logfile in place
2011-08-05 20:39 ` Andy Koppe
@ 2011-08-06 9:03 ` Csaba Raduly
2011-08-06 10:38 ` Christian Franke
0 siblings, 1 reply; 5+ messages in thread
From: Csaba Raduly @ 2011-08-06 9:03 UTC (permalink / raw)
To: cygwin; +Cc: Christian Franke
On Fri, Aug 5, 2011 at 10:38 PM, Andy Koppe wrote:
> On 4 August 2011 10:57, Christian Franke wrote:
>> The mintty --log option is very useful but opens logfile without O_TRUNC
>> or O_APPEND:
(snip)
>> I would suggest to add O_APPEND.
>
> I'll ponder that. The original intention was O_TRUNC.
>
Ideally it could be made user-selectable.
The effect of O_TRUNC can be manually replicated by deleting the
existing log, but I suspect few would bother; resulting in large log
files.
The effect of o_APPEND can be manually replicated by renaming and
concatenating the log files.
Csaba
--
GCS a+ e++ d- C++ ULS$ L+$ !E- W++ P+++$ w++$ tv+ b++ DI D++ 5++
The Tao of math: The numbers you can count are not the real numbers.
Life is complex, with real and imaginary parts.
"Ok, it boots. Which means it must be bug-free and perfect. " -- Linus Torvalds
"People disagree with me. I just ignore them." -- Linus Torvalds
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: mintty --log overwrites existing logfile in place
2011-08-06 9:03 ` Csaba Raduly
@ 2011-08-06 10:38 ` Christian Franke
2011-08-07 11:10 ` Csaba Raduly
0 siblings, 1 reply; 5+ messages in thread
From: Christian Franke @ 2011-08-06 10:38 UTC (permalink / raw)
To: cygwin
Csaba Raduly wrote:
> On Fri, Aug 5, 2011 at 10:38 PM, Andy Koppe wrote:
>
>> On 4 August 2011 10:57, Christian Franke wrote:
>>
>>> The mintty --log option is very useful but opens logfile without O_TRUNC
>>> or O_APPEND:
>>>
> (snip)
>
>>> I would suggest to add O_APPEND.
>>>
>> I'll ponder that. The original intention was O_TRUNC.
>>
>>
> Ideally it could be made user-selectable.
>
Agree, e.g. "--log +FILE" appends to FILE:
client.c:
// Open log file if any
if (*cfg.log) {
if (cfg.log[0] == '+' && cfg.log[1])
log_fd = open(cfg.log+1, O_WRONLY | O_CREAT | O_APPEND, 0600);
else
log_fd = open(cfg.log, O_WRONLY | O_CREAT | O_TRUNC, 0600);
if (log_fd < 0)
error("open log file");
}
Thanks,
Christian
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: mintty --log overwrites existing logfile in place
2011-08-06 10:38 ` Christian Franke
@ 2011-08-07 11:10 ` Csaba Raduly
0 siblings, 0 replies; 5+ messages in thread
From: Csaba Raduly @ 2011-08-07 11:10 UTC (permalink / raw)
To: cygwin
On Sat, Aug 6, 2011 at 12:37 PM, Christian Franke wrote:
> Agree, e.g. "--log +FILE" appends to FILE:
>
> client.c:
> // Open log file if any
> if (*cfg.log) {
> if (cfg.log[0] == '+' && cfg.log[1])
> log_fd = open(cfg.log+1, O_WRONLY | O_CREAT | O_APPEND, 0600);
> else
> log_fd = open(cfg.log, O_WRONLY | O_CREAT | O_TRUNC, 0600);
> if (log_fd < 0)
> error("open log file");
> }
I was thinking along the lines of a user preference. I don't like
magic file names. But it's up to Andy :)
Csaba
--
GCS a+ e++ d- C++ ULS$ L+$ !E- W++ P+++$ w++$ tv+ b++ DI D++ 5++
The Tao of math: The numbers you can count are not the real numbers.
Life is complex, with real and imaginary parts.
"Ok, it boots. Which means it must be bug-free and perfect. " -- Linus Torvalds
"People disagree with me. I just ignore them." -- Linus Torvalds
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-08-07 11:10 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-04 9:57 mintty --log overwrites existing logfile in place Christian Franke
2011-08-05 20:39 ` Andy Koppe
2011-08-06 9:03 ` Csaba Raduly
2011-08-06 10:38 ` Christian Franke
2011-08-07 11:10 ` Csaba Raduly
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 read-only IMAP folder(s) and NNTP newsgroup(s).