* [patches] standardizing the error messages "cannot read %s" and "seek on %s failed"
@ 2013-10-08 15:40 Benno Schulenberg
2013-10-09 9:47 ` Karel Zak
0 siblings, 1 reply; 5+ messages in thread
From: Benno Schulenberg @ 2013-10-08 15:40 UTC (permalink / raw)
To: Util-Linux
[-- Attachment #1: Type: text/plain, Size: 338 bytes --]
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
--
http://www.fastmail.fm - Send your email first class
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-textual-standardize-some-cannot-read-and-seek-failed.patch --]
[-- Type: text/x-patch; name="0001-textual-standardize-some-cannot-read-and-seek-failed.patch", Size: 6227 bytes --]
From decdac2cd98de8cb5b84b5007bafc8fb3a8d3afd Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@justemail.net>
Date: Tue, 8 Oct 2013 17:04:22 +0200
Subject: [PATCH 1/5] textual: standardize some "cannot read" and "seek failed" error messages
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
---
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(-)
diff --git a/disk-utils/fsck.c b/disk-utils/fsck.c
index 19eabe3..00622c4 100644
--- a/disk-utils/fsck.c
+++ b/disk-utils/fsck.c
@@ -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);
}
diff --git a/disk-utils/fsck.cramfs.c b/disk-utils/fsck.cramfs.c
index 3c861d5..cd23345 100644
--- a/disk-utils/fsck.cramfs.c
+++ b/disk-utils/fsck.cramfs.c
@@ -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)
diff --git a/lib/path.c b/lib/path.c
index 7a68d9f..1f7e258 100644
--- a/lib/path.c
+++ b/lib/path.c
@@ -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);
diff --git a/login-utils/last.c b/login-utils/last.c
index 8da42ba..5550dcb 100644
--- a/login-utils/last.c
+++ b/login-utils/last.c
@@ -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;
}
diff --git a/login-utils/sulogin.c b/login-utils/sulogin.c
index 352c781..4560ee0 100644
--- a/login-utils/sulogin.c
+++ b/login-utils/sulogin.c
@@ -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;
diff --git a/sys-utils/setpriv.c b/sys-utils/setpriv.c
index a572736..c3f2a8b 100644
--- a/sys-utils/setpriv.c
+++ b/sys-utils/setpriv.c
@@ -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) {
--
1.7.0.4
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-libfdisk-dos-correct-the-grammar-of-the-disk-identif.patch --]
[-- Type: text/x-patch; name="0002-libfdisk-dos-correct-the-grammar-of-the-disk-identif.patch", Size: 824 bytes --]
From 74f0a6a749d4ef022ed17e7f01fb58899b54b03f Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@justemail.net>
Date: Tue, 8 Oct 2013 17:11:01 +0200
Subject: [PATCH 2/5] libfdisk/dos: correct the grammar of the disk-identifier prompt
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
---
libfdisk/src/dos.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/libfdisk/src/dos.c b/libfdisk/src/dos.c
index 06971de..c90721d 100644
--- a/libfdisk/src/dos.c
+++ b/libfdisk/src/dos.c
@@ -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;
--
1.7.0.4
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0003-libfdisk-dos-improve-the-grammar-of-an-error-message.patch --]
[-- Type: text/x-patch; name="0003-libfdisk-dos-improve-the-grammar-of-an-error-message.patch", Size: 829 bytes --]
From 1daa896a55e18807990863ba4f8124df5ba30d91 Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@justemail.net>
Date: Tue, 8 Oct 2013 17:14:38 +0200
Subject: [PATCH 3/5] libfdisk/dos: improve the grammar of an error message
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
---
libfdisk/src/dos.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/libfdisk/src/dos.c b/libfdisk/src/dos.c
index c90721d..520ba34 100644
--- a/libfdisk/src/dos.c
+++ b/libfdisk/src/dos.c
@@ -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;
}
--
1.7.0.4
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #5: 0004-libfdisk-gpt-use-consistent-final-period-in-status-m.patch --]
[-- Type: text/x-patch; name="0004-libfdisk-gpt-use-consistent-final-period-in-status-m.patch", Size: 1524 bytes --]
From 3e0ea7e8f800fdb0bba7c8caa2c50bf426f61acd Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@justemail.net>
Date: Tue, 8 Oct 2013 17:18:18 +0200
Subject: [PATCH 4/5] libfdisk/gpt: use consistent final period in status messages
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
---
libfdisk/src/gpt.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/libfdisk/src/gpt.c b/libfdisk/src/gpt.c
index c04b21e..448b1ff 100644
--- a/libfdisk/src/gpt.c
+++ b/libfdisk/src/gpt.c
@@ -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);
--
1.7.0.4
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #6: 0005-losetup-cut-the-remaining-little-block-of-help-text-.patch --]
[-- Type: text/x-patch; name="0005-losetup-cut-the-remaining-little-block-of-help-text-.patch", Size: 1655 bytes --]
From 21be54adc0372b0a0c907877308734202e041940 Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@justemail.net>
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
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
---
sys-utils/losetup.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/sys-utils/losetup.c b/sys-utils/losetup.c
index 9169f88..5be3288 100644
--- a/sys-utils/losetup.c
+++ b/sys-utils/losetup.c
@@ -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);
--
1.7.0.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [patches] standardizing the error messages "cannot read %s" and "seek on %s failed"
2013-10-08 15:40 [patches] standardizing the error messages "cannot read %s" and "seek on %s failed" Benno Schulenberg
@ 2013-10-09 9:47 ` Karel Zak
2013-10-09 10:32 ` Benno Schulenberg
2013-10-09 18:57 ` docs: improve the cal --help [was: standardizing...] Benno Schulenberg
0 siblings, 2 replies; 5+ messages in thread
From: Karel Zak @ 2013-10-09 9:47 UTC (permalink / raw)
To: Benno Schulenberg; +Cc: Util-Linux
On Tue, Oct 08, 2013 at 05:40:07PM +0200, Benno Schulenberg wrote:
> 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
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patches] standardizing the error messages "cannot read %s" and "seek on %s failed"
2013-10-09 9:47 ` Karel Zak
@ 2013-10-09 10:32 ` Benno Schulenberg
2013-10-09 18:57 ` docs: improve the cal --help [was: standardizing...] Benno Schulenberg
1 sibling, 0 replies; 5+ messages in thread
From: Benno Schulenberg @ 2013-10-09 10:32 UTC (permalink / raw)
To: Karel Zak; +Cc: Util-Linux
On Wed, Oct 9, 2013, at 11:47, Karel Zak wrote:
> 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
--
http://www.fastmail.fm - Choose from over 50 domains or use your own
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: docs: improve the cal --help [was: standardizing...]
2013-10-09 9:47 ` Karel Zak
2013-10-09 10:32 ` Benno Schulenberg
@ 2013-10-09 18:57 ` Benno Schulenberg
2013-10-11 8:52 ` Karel Zak
1 sibling, 1 reply; 5+ messages in thread
From: Benno Schulenberg @ 2013-10-09 18:57 UTC (permalink / raw)
To: Karel Zak; +Cc: Util-Linux, Pádraig Brady
[-- Attachment #1: Type: text/plain, Size: 553 bytes --]
On Wed, Oct 9, 2013, at 11:47, Karel Zak wrote:
> 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
--
http://www.fastmail.fm - Or how I learned to stop worrying and
love email again
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-docs-improve-the-cal-help-text-and-man-page.patch --]
[-- Type: text/x-patch; name="0001-docs-improve-the-cal-help-text-and-man-page.patch", Size: 2793 bytes --]
From 4d1675bc2e513dce30290c6787cf75ceaf9b820d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
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.
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: Pádraig Brady <P@draigBrady.com>
---
misc-utils/cal.1 | 4 ++--
misc-utils/cal.c | 9 ++++++---
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/misc-utils/cal.1 b/misc-utils/cal.1
index 4e7570d..0e686dd 100644
--- a/misc-utils/cal.1
+++ b/misc-utils/cal.1
@@ -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
diff --git a/misc-utils/cal.c b/misc-utils/cal.c
index 76d6252..27f94d1 100644
--- a/misc-utils/cal.c
+++ b/misc-utils/cal.c
@@ -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);
--
1.7.0.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: docs: improve the cal --help [was: standardizing...]
2013-10-09 18:57 ` docs: improve the cal --help [was: standardizing...] Benno Schulenberg
@ 2013-10-11 8:52 ` Karel Zak
0 siblings, 0 replies; 5+ messages in thread
From: Karel Zak @ 2013-10-11 8:52 UTC (permalink / raw)
To: Benno Schulenberg; +Cc: Util-Linux, Pádraig Brady
On Wed, Oct 09, 2013 at 08:57:09PM +0200, Benno Schulenberg wrote:
> misc-utils/cal.1 | 4 ++--
> misc-utils/cal.c | 9 ++++++---
> 2 files changed, 8 insertions(+), 5 deletions(-)
Applied with some minor changed, thanks.
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-10-11 8:53 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-08 15:40 [patches] standardizing the error messages "cannot read %s" and "seek on %s failed" Benno Schulenberg
2013-10-09 9:47 ` Karel Zak
2013-10-09 10:32 ` Benno Schulenberg
2013-10-09 18:57 ` docs: improve the cal --help [was: standardizing...] Benno Schulenberg
2013-10-11 8:52 ` Karel Zak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox