* Minor cosmetic defect in git-pack-objects output @ 2011-03-29 10:10 Antonio Ospite 2011-03-29 20:13 ` René Scharfe 0 siblings, 1 reply; 3+ messages in thread From: Antonio Ospite @ 2011-03-29 10:10 UTC (permalink / raw) To: git; +Cc: Junio C Hamano [-- Attachment #1: Type: text/plain, Size: 1258 bytes --] Hi, in some cases, on git-pack-objects failure, there is a small defect in the output, see: # git gc --aggressive Counting objects: 1954118, done. Delta compression using up to 2 threads. warning: suboptimal pack - out of memory02) Compressing objects: 100% (1936802/1936802), done. Writing objects: 100% (1954118/1954118), done. Total 1954118 (delta 1618716), reused 0 (delta 0) The defect is here: warning: suboptimal pack - out of memory02) ^^^ the trailing chars are from the replaced line which was ending in 1936802) AFAICS this is basically what is happening: #include "git-compat-util.h" fprintf(stderr, "Compressing objects: 15% (296661/1936802)\r"); warning("suboptimal pack - out of memory"); I can think to a dumb workaround for this particular path but maybe there are other places when this can happen as well. Anyway it is not a big deal, but since I noticed it I wanted to report that. Regards, Antonio -- Antonio Ospite http://ao2.it PGP public key ID: 0x4553B001 A: Because it messes up the order in which people normally read text. See http://en.wikipedia.org/wiki/Posting_style Q: Why is top-posting such a bad thing? [-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --] ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Minor cosmetic defect in git-pack-objects output 2011-03-29 10:10 Minor cosmetic defect in git-pack-objects output Antonio Ospite @ 2011-03-29 20:13 ` René Scharfe 2011-03-29 20:48 ` Antonio Ospite 0 siblings, 1 reply; 3+ messages in thread From: René Scharfe @ 2011-03-29 20:13 UTC (permalink / raw) To: Antonio Ospite; +Cc: git, Junio C Hamano Am 29.03.2011 12:10, schrieb Antonio Ospite: > Hi, > > in some cases, on git-pack-objects failure, there is a small defect in > the output, see: > > # git gc --aggressive > Counting objects: 1954118, done. > Delta compression using up to 2 threads. > warning: suboptimal pack - out of memory02) > Compressing objects: 100% (1936802/1936802), done. > Writing objects: 100% (1954118/1954118), done. > Total 1954118 (delta 1618716), reused 0 (delta 0) > > The defect is here: > warning: suboptimal pack - out of memory02) > ^^^ > the trailing chars are from the replaced line which was ending in > 1936802) > > AFAICS this is basically what is happening: > #include "git-compat-util.h" > fprintf(stderr, "Compressing objects: 15% (296661/1936802)\r"); > warning("suboptimal pack - out of memory"); > > I can think to a dumb workaround for this particular path but maybe > there are other places when this can happen as well. The following patch should avoid it by clearing the the rest of the line after warnings, error messages, usage notes etc. if stderr is a terminal. René --- usage.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/usage.c b/usage.c index b5e67e3..36f1968 100644 --- a/usage.c +++ b/usage.c @@ -9,7 +9,7 @@ void vreportf(const char *prefix, const char *err, va_list params) { char msg[4096]; vsnprintf(msg, sizeof(msg), err, params); - fprintf(stderr, "%s%s\n", prefix, msg); + fprintf(stderr, "%s%s%s\n", prefix, msg, isatty(2) ? "\033[K" : ""); } static NORETURN void usage_builtin(const char *err, va_list params) ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: Minor cosmetic defect in git-pack-objects output 2011-03-29 20:13 ` René Scharfe @ 2011-03-29 20:48 ` Antonio Ospite 0 siblings, 0 replies; 3+ messages in thread From: Antonio Ospite @ 2011-03-29 20:48 UTC (permalink / raw) To: René Scharfe; +Cc: git, Junio C Hamano [-- Attachment #1: Type: text/plain, Size: 2286 bytes --] On Tue, 29 Mar 2011 22:13:13 +0200 René Scharfe <rene.scharfe@lsrfire.ath.cx> wrote: > Am 29.03.2011 12:10, schrieb Antonio Ospite: > > Hi, > > > > in some cases, on git-pack-objects failure, there is a small defect in > > the output, see: > > > > # git gc --aggressive > > Counting objects: 1954118, done. > > Delta compression using up to 2 threads. > > warning: suboptimal pack - out of memory02) > > Compressing objects: 100% (1936802/1936802), done. > > Writing objects: 100% (1954118/1954118), done. > > Total 1954118 (delta 1618716), reused 0 (delta 0) > > > > The defect is here: > > warning: suboptimal pack - out of memory02) > > ^^^ > > the trailing chars are from the replaced line which was ending in > > 1936802) > > > > AFAICS this is basically what is happening: > > #include "git-compat-util.h" > > fprintf(stderr, "Compressing objects: 15% (296661/1936802)\r"); > > warning("suboptimal pack - out of memory"); > > > > I can think to a dumb workaround for this particular path but maybe > > there are other places when this can happen as well. > > The following patch should avoid it by clearing the the rest of the > line after warnings, error messages, usage notes etc. if stderr is a > terminal. > Cool, this is working indeed on the terminal, I don't know if introducing a CLEARLINE macro would look prettier. Thanks René. Regards, Antonio > René > > --- > usage.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/usage.c b/usage.c > index b5e67e3..36f1968 100644 > --- a/usage.c > +++ b/usage.c > @@ -9,7 +9,7 @@ void vreportf(const char *prefix, const char *err, va_list params) > { > char msg[4096]; > vsnprintf(msg, sizeof(msg), err, params); > - fprintf(stderr, "%s%s\n", prefix, msg); > + fprintf(stderr, "%s%s%s\n", prefix, msg, isatty(2) ? "\033[K" : ""); > } > > static NORETURN void usage_builtin(const char *err, va_list params) > > -- Antonio Ospite http://ao2.it PGP public key ID: 0x4553B001 A: Because it messes up the order in which people normally read text. See http://en.wikipedia.org/wiki/Posting_style Q: Why is top-posting such a bad thing? [-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --] ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-03-29 20:48 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2011-03-29 10:10 Minor cosmetic defect in git-pack-objects output Antonio Ospite 2011-03-29 20:13 ` René Scharfe 2011-03-29 20:48 ` Antonio Ospite
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).