standardizing the error messages "cannot read %s" and "seek on %s failed"
Subsystems (2)
PATCH 1/1 standardizing the error messages "cannot read %s" and "seek on %s failed"
Hi,
First patch standardizes the plain "cannot read %s" and "seek on %s failed" error messages. Second, third and fourth make some tiny textual corrections. Fifth patch slices up also the first third of the help text of losetup; the rest of the text is already sliced.
Benno
Signature · 1 line
http://www.fastmail.fm - Send your email first class
From decdac2cd98de8cb5b84b5007bafc8fb3a8d3afd Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <[email protected]>
Date: Tue, 8 Oct 2013 17:04:22 +0200
Subject: [PATCH 1/5] textual: standardize some "cannot read" and "seek failed" error messages
--- disk-utils/fsck.c | 2 +- disk-utils/fsck.cramfs.c | 14 +++++++------- lib/path.c | 8 ++++---- login-utils/last.c | 8 ++++---- login-utils/sulogin.c | 2 +- sys-utils/setpriv.c | 2 +- 6 files changed, 18 insertions(+), 18 deletions(-)
disk-utils/fsck.c +1 -1
@@ -304,7 +304,7 @@ static int is_irrotational_disk(dev_t disk) rc =fscanf (f,"%d" , &x);if (rc !=1 ) {if (ferror (f)) -warn (_ ("failed to read: %s" ), path); +warn (_ ("cannot read %s" ), path);else warnx (_ ("parse error: %s" ), path); }
disk-utils/fsck.cramfs.c +7 -7
@@ -166,14 +166,14 @@ static void test_super(int *start, size_t * length)/* find superblock */ if (read (fd, &super,sizeof (super)) !=sizeof (super)) -err (FSCK_EX_ERROR ,_ ("read failed: %s" ), filename); +err (FSCK_EX_ERROR ,_ ("cannot read %s" ), filename);if (get_superblock_endianness (super.magic) !=-1 ) *start =0 ;else if (*length >= (PAD_SIZE +sizeof (super))) {if (lseek (fd,PAD_SIZE ,SEEK_SET ) == (off_t) -1 ) -err (FSCK_EX_ERROR ,_ ("seek failed: %s" ), filename); +err (FSCK_EX_ERROR ,_ ("seek on %s failed" ), filename);if (read (fd, &super,sizeof (super)) !=sizeof (super)) -err (FSCK_EX_ERROR ,_ ("read failed: %s" ), filename); +err (FSCK_EX_ERROR ,_ ("cannot read %s" ), filename);if (get_superblock_endianness (super.magic) !=-1 ) *start =PAD_SIZE ;else
@@ -228,9 +228,9 @@ static void test_crc(int start) MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);if (buf !=MAP_FAILED ) {if (lseek (fd,0 ,SEEK_SET ) == (off_t) -1 ) -err (FSCK_EX_ERROR ,_ ("seek failed: %s" ), filename); +err (FSCK_EX_ERROR ,_ ("seek on %s failed" ), filename);if (read (fd, buf, super.size) <0 ) -err (FSCK_EX_ERROR ,_ ("read failed: %s" ), filename); +err (FSCK_EX_ERROR ,_ ("cannot read %s" ), filename); } }if (buf !=MAP_FAILED ) {
@@ -244,11 +244,11 @@ static void test_crc(int start) buf =xmalloc (4096 );if (lseek (fd, start,SEEK_SET ) == (off_t) -1 ) -err (FSCK_EX_ERROR ,_ ("seek failed: %s" ), filename); +err (FSCK_EX_ERROR ,_ ("seek on %s failed" ), filename);for (;;) { retval =read (fd, buf,4096 );if (retval <0 ) -err (FSCK_EX_ERROR ,_ ("read failed: %s" ), filename); +err (FSCK_EX_ERROR ,_ ("cannot read %s" ), filename);else if (retval ==0 )break ;if (length ==0 )
lib/path.c +4 -4
@@ -97,7 +97,7 @@ path_read_str(char *result, size_t len, const char *path, ...)va_end (ap);if (!fgets (result, len, fd)) -err (EXIT_FAILURE ,_ ("failed to read: %s" ), pathbuf); +err (EXIT_FAILURE ,_ ("cannot read %s" ), pathbuf);fclose (fd); len =strlen (result);
@@ -118,7 +118,7 @@ path_read_s32(const char *path, ...)if (fscanf (fd,"%d" , &result) !=1 ) {if (ferror (fd)) -err (EXIT_FAILURE ,_ ("failed to read: %s" ), pathbuf); +err (EXIT_FAILURE ,_ ("cannot read %s" ), pathbuf);else errx (EXIT_FAILURE ,_ ("parse error: %s" ), pathbuf); }
@@ -139,7 +139,7 @@ path_read_u64(const char *path, ...)if (fscanf (fd,"%" SCNu64, &result) !=1 ) {if (ferror (fd)) -err (EXIT_FAILURE ,_ ("failed to read: %s" ), pathbuf); +err (EXIT_FAILURE ,_ ("cannot read %s" ), pathbuf);else errx (EXIT_FAILURE ,_ ("parse error: %s" ), pathbuf); }
@@ -187,7 +187,7 @@ path_cpuparse(int maxcpus, int islist, const char *path, va_list ap) fd =path_vfopen ("r" UL_CLOEXECSTR ,1 , path, ap);if (!fgets (buf, len, fd)) -err (EXIT_FAILURE ,_ ("failed to read: %s" ), pathbuf); +err (EXIT_FAILURE ,_ ("cannot read %s" ), pathbuf);fclose (fd); len =strlen (buf);
login-utils/last.c +4 -4
@@ -186,12 +186,12 @@ static int uread(const struct last_control *ctl, FILE *fp, struct utmp *u,return 0 ; o = ((fpos -1 ) /UCHUNKSIZE ) *UCHUNKSIZE ;if (fseeko (fp, o,SEEK_SET ) <0 ) { -warn (_ ("seek failed: %s" ), ctl->altv[ctl->alti]); +warn (_ ("seek on %s failed" ), ctl->altv[ctl->alti]);return 0 ; } bpos = (int )(fpos - o);if (fread (buf, bpos,1 , fp) !=1 ) { -warn (_ ("read failed: %s" ), ctl->altv[ctl->alti]); +warn (_ ("cannot read %s" ), ctl->altv[ctl->alti]);return 0 ; } fpos = o;
@@ -220,7 +220,7 @@ static int uread(const struct last_control *ctl, FILE *fp, struct utmp *u,*/ memcpy (tmp + (-bpos), buf, utsize + bpos);if (fseeko (fp, fpos,SEEK_SET ) <0 ) { -warn (_ ("seek failed: %s" ), ctl->altv[ctl->alti]); +warn (_ ("seek on %s failed" ), ctl->altv[ctl->alti]);return 0 ; }
@@ -228,7 +228,7 @@ static int uread(const struct last_control *ctl, FILE *fp, struct utmp *u,* Read another UCHUNKSIZE bytes. */ if (fread (buf,UCHUNKSIZE ,1 , fp) !=1 ) { -warn (_ ("read failed: %s" ), ctl->altv[ctl->alti]); +warn (_ ("cannot read %s" ), ctl->altv[ctl->alti]);return 0 ; }
login-utils/sulogin.c +1 -1
@@ -602,7 +602,7 @@ static char *getpasswd(struct console *con)case ENOENT :break ;default : -warn (_ ("%s: read failed" ), con->tty); +warn (_ ("cannot read %s" ), con->tty);break ; } goto quit;
sys-utils/setpriv.c +1 -1
@@ -230,7 +230,7 @@ static void dump_label(const char *name)close (fd);if (len <0 ) { errno = e; -warn (_ ("read failed: %s" ), name); +warn (_ ("cannot read %s" ), name);return ; }if (sizeof (buf) -1 <= (size_t )len) {
Signature · 1 line
1.7.0.4
From 74f0a6a749d4ef022ed17e7f01fb58899b54b03f Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <[email protected]>
Date: Tue, 8 Oct 2013 17:11:01 +0200
Subject: [PATCH 2/5] libfdisk/dos: correct the grammar of the disk-identifier prompt
--- libfdisk/src/dos.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
libfdisk/src/dos.c +1 -1
@@ -566,7 +566,7 @@ static int dos_set_disklabel_id(struct fdisk_context *cxt) l =self_label (cxt); old =mbr_get_id (cxt->firstsector); rc =fdisk_ask_string (cxt, -_ ("Enter of the new disk identifier" ), &str); +_ ("Enter the new disk identifier" ), &str);if (rc)return rc;
Signature · 1 line
1.7.0.4
From 1daa896a55e18807990863ba4f8124df5ba30d91 Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <[email protected]>
Date: Tue, 8 Oct 2013 17:14:38 +0200
Subject: [PATCH 3/5] libfdisk/dos: improve the grammar of an error message
--- libfdisk/src/dos.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
libfdisk/src/dos.c +1 -1
@@ -1322,7 +1322,7 @@ static int write_sector(struct fdisk_context *cxt, sector_t secno, rc =seek_sector (cxt, secno);if (rc !=0 ) { -fdisk_warn (cxt,_ ("Write sector %jd failed: seek failed" ), +fdisk_warn (cxt,_ ("Cannot write sector %jd: seek failed" ), (uintmax_t ) secno);return rc; }
Signature · 1 line
1.7.0.4
From 3e0ea7e8f800fdb0bba7c8caa2c50bf426f61acd Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <[email protected]>
Date: Tue, 8 Oct 2013 17:18:18 +0200
Subject: [PATCH 4/5] libfdisk/gpt: use consistent final period in status messages
--- libfdisk/src/gpt.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
libfdisk/src/gpt.c +3 -3
@@ -1811,7 +1811,7 @@ static int gpt_create_disklabel(struct fdisk_context *cxt)guid_to_string (&gpt->pheader->disk_guid, str);fdisk_label_set_changed (cxt->label,1 );fdisk_sinfo (cxt,FDISK_INFO_SUCCESS , -_ ("Created a new GPT disklabel (GUID: %s)" ), str); +_ ("Created a new GPT disklabel (GUID: %s)." ), str); done:return rc; }
@@ -1998,7 +1998,7 @@ int fdisk_gpt_partition_set_uuid(struct fdisk_context *cxt, size_t i)fdisk_label_set_changed (cxt->label,1 );fdisk_sinfo (cxt,FDISK_INFO_SUCCESS , -_ ("Partition UUID changed from %s to %s" ), +_ ("Partition UUID changed from %s to %s." ), old_u, new_u);return 0 ; }
@@ -2043,7 +2043,7 @@ int fdisk_gpt_partition_set_name(struct fdisk_context *cxt, size_t i)fdisk_label_set_changed (cxt->label,1 );fdisk_sinfo (cxt,FDISK_INFO_SUCCESS , -_ ("Partition name changed from '%s' to '%.*s'" ), +_ ("Partition name changed from '%s' to '%.*s'." ), old,GPT_PART_NAME_LEN , str);free (str);free (old);
Signature · 1 line
1.7.0.4
From 21be54adc0372b0a0c907877308734202e041940 Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <[email protected]>
Date: Tue, 8 Oct 2013 17:29:20 +0200
Subject: [PATCH 5/5] losetup: cut the remaining little block of help text into slices too
--- sys-utils/losetup.c | 13 +++++++------ 1 files changed, 7 insertions(+), 6 deletions(-)
sys-utils/losetup.c +7 -6
@@ -368,12 +368,13 @@ static void usage(FILE *out) program_invocation_short_name);fputs (USAGE_OPTIONS , out); -fputs (_ (" -a, --all list all used devices\n" -" -d, --detach <loopdev> [...] detach one or more devices\n" -" -D, --detach-all detach all used devices\n" -" -f, --find find first unused device\n" -" -c, --set-capacity <loopdev> resize device\n" -" -j, --associated <file> list all devices associated with <file>\n" ), out); +fputs (_ (" -a, --all list all used devices\n" ), out); +fputs (_ (" -d, --detach <loopdev> [...] detach one or more devices\n" ), out); +fputs (_ (" -D, --detach-all detach all used devices\n" ), out); +fputs (_ (" -f, --find find first unused device\n" ), out); +fputs (_ (" -c, --set-capacity <loopdev> resize device\n" ), out); +fputs (_ (" -j, --associated <file> list all devices associated with <file>\n" ), out); +fputs (USAGE_SEPARATOR , out);fputs (_ (" -o, --offset <num> start at offset <num> into file\n" ), out);
Signature · 1 line
1.7.0.4
Quoted 4 lines · Benno Schulenberg
First patch standardizes the plain "cannot read %s" and "seek on %s failed" error messages. Second, third and fourth make some tiny textual corrections. Fifth patch slices up also the first third of the help text of losetup; the rest of the text is already sliced.
Applied, thanks.
So I guess we're ready for -rc2, right? (probably tomorrow/Friday)
Karel
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com
Quoted 1 line · Karel Zak
So I guess we're ready for -rc2, right? (probably tomorrow/Friday)
Yes, for this cycle I'm done. :)
If I do anything else, it will be just man pages.
Benno
Signature · 1 line
http://www.fastmail.fm - Choose from over 50 domains or use your own
Re: docs: improve the cal --help [was: standardizing...]
In reply to Karel ZakQuoted 1 line · Karel Zak
So I guess we're ready for -rc2, right? (probably tomorrow/Friday)
Oh. Maybe still apply Pádraig's patch to improve cal's help text. I have somehow lost his original message, but I had downloaded his patch, and have attached a slightly improved version: adding a tiny doc string and a period, and using "arguments" instead of "options". Okay with you, Pádraig?
Benno
Signature · 2 lines
http://www.fastmail.fm - Or how I learned to stop worrying and
love email againFrom 4d1675bc2e513dce30290c6787cf75ceaf9b820d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <[email protected]>
Date: Wed, 9 Oct 2013 20:44:12 +0200
Subject: [PATCH] docs: improve the 'cal' help text and man page
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* misc-utils/cal.c: Add a little doc string, and mention that the current month is implicit if not specified. Also remove mention of "current" from two option descriptions as a specific date may have been specified.
* misc-utils/cal.1: Likewise.
--- misc-utils/cal.1 | 4 ++-- misc-utils/cal.c | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-)
misc-utils/cal.1 +2 -2
@@ -51,7 +51,7 @@ Display single month output. (This is the default.) .TP \fB\-3\fR, \fB\-\-three\fR -Display prev/current/next month output. +Display three months spanning the date. .TP \fB\-s\fR, \fB\-\-sunday\fR Display Sunday as the first day of the week.
@@ -63,7 +63,7 @@ Display Monday as the first day of the week. Display Julian dates (days one-based, numbered from January 1). .TP \fB\-y\fR, \fB\-\-year\fR -Display a calendar for the current year. +Display a calendar for the whole year. .TP \fB\-\-color\fR [\fIwhen\fR] Colorize output. The
misc-utils/cal.c +6 -3
@@ -805,13 +805,16 @@ static void __attribute__ ((__noreturn__)) usage(FILE * out)fputs (USAGE_HEADER , out);fprintf (out,_ (" %s [options] [[[day] month] year]\n" ), program_invocation_short_name); +fprintf (out,_ ("\nDisplay a calendar, or some part of it.\n" )); +fprintf (out,_ ("Without any arguments, display the current month.\n" )); +fputs (USAGE_OPTIONS , out); -fputs (_ (" -1, --one show only current month (default)\n" ), out); -fputs (_ (" -3, --three show previous, current and next month\n" ), out); +fputs (_ (" -1, --one show only a single month (default)\n" ), out); +fputs (_ (" -3, --three show three months spanning the date\n" ), out);fputs (_ (" -s, --sunday Sunday as first day of week\n" ), out);fputs (_ (" -m, --monday Monday as first day of week\n" ), out);fputs (_ (" -j, --julian output Julian dates\n" ), out); -fputs (_ (" -y, --year show whole current year\n" ), out); +fputs (_ (" -y, --year show the whole year\n" ), out);fputs (_ (" --color[=<when>] colorize messages (auto, always or never)\n" ), out);fputs (USAGE_SEPARATOR , out);
Signature · 1 line
1.7.0.4
Karel Zak
maintainerRe: docs: improve the cal --help [was: standardizing...]
Quoted 3 lines · Benno Schulenberg
misc-utils/cal.1 | 4 ++-- misc-utils/cal.c | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-)
Applied with some minor changed, thanks.
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com