Pádraig Brady [Mon, 1 Oct 2007 23:22:45 +0000 (00:22 +0100)]
cal: add support for highlighting an arbitrary date
This is done by calling cal with the extra day parameter like:
cal 14 9 1752
Note the tests were updated to use the new syntax.
Note also that this patch changes the -y option
to always print a full year, even if a month or
the -[13] options are specified.
This matches the cal operation from bsdmainutils on debian
and also allows one to print a full year while
highlighting a particular date.
Karel Zak [Wed, 3 Oct 2007 21:15:03 +0000 (14:15 -0700)]
tailf: clean up gcc warnings & fix use of errno
Fix strict gcc warnings in tailf that come from using:
("-Wall -Wp,-D_FORTIFY_SOURCE=2")
tailf.c:111: warning: ignoring return value of 'fwrite', declared with attribute warn_unused_result
Also, tailf uses perror() for error reporting, but it inserts
an fprintf call first, so perror() is actually reporting the
result of the fprintf() call, not the failing call; change
the code to print the message by using strerror() instead.
Builds cleanly on x86_32 and x86_64.
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Randy Dunlap [Mon, 8 Oct 2007 16:59:18 +0000 (09:59 -0700)]
losetup: clean up gcc warnings
Fix strict gcc warnings that come from using:
("-Wall -Wp,-D_FORTIFY_SOURCE=2")
lomount.c:98: warning: pointer targets in initialization differ in signedness
lomount.c:111: warning: format '%04x' expects type 'unsigned int', but argument 4 has type '__kernel_old_dev_t'
lomount.c:300: warning: pointer targets in passing argument 1 of 'xstrncpy' differ in signedness
lomount.c:307: warning: pointer targets in passing argument 1 of '__builtin___snprintf_chk' differ in signedness
lomount.c:339: warning: pointer targets in passing argument 1 of 'xstrncpy' differ in signedness
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Karel Zak [Wed, 3 Oct 2007 21:15:18 +0000 (14:15 -0700)]
mount: improve chmod & chown usage and clean up gcc warnings (fstab.c)
Fix strict gcc warnings in tailf that come from using:
("-Wall -Wp,-D_FORTIFY_SOURCE=2")
fstab.c:770: warning: ignoring return value of 'chown', declared with attribute warn_unused_result
The patch makes chmod() and chown() mandatory. We cannot rename()
temporary mtab to the final mtab when owner is not the same user as
owner of the original mtab. It's security risk.
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Randy Dunlap [Sat, 29 Sep 2007 08:12:06 +0000 (01:12 -0700)]
mkfs.cramfs: clean up gcc warnings
* clean up code, gcc warnings
(try compilation with "-Wall -Wp,-D_FORTIFY_SOURCE=2")
Builds cleanly on x86_32 and x86_64.
mkfs.cramfs.c:211: warning: pointer targets in passing argument 2 of 'MD5Update' differ in signedness
mkfs.cramfs.c:336: warning: format '%u' expects type 'unsigned int', but argument 4 has type 'size_t'
mkfs.cramfs.c:355: warning: pointer targets in assignment differ in signedness
mkfs.cramfs.c:448: warning: pointer targets in passing argument 1 of '__builtin___strncpy_chk' differ in signedness
mkfs.cramfs.c:448: warning: pointer targets in passing argument 1 of '__strncpy_ichk' differ in signedness
mkfs.cramfs.c:450: warning: pointer targets in passing argument 1 of '__builtin___strncpy_chk' differ in signedness
mkfs.cramfs.c:450: warning: pointer targets in passing argument 1 of '__strncpy_ichk' differ in signedness
mkfs.cramfs.c:490: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
mkfs.cramfs.c:620: warning: pointer targets in passing argument 1 of 'compress' differ in signedness
mkfs.cramfs.c:620: warning: pointer targets in passing argument 3 of 'compress' differ in signedness
mkfs.cramfs.c:671: warning: pointer targets in passing argument 3 of 'do_compress' differ in signedness
mkfs.cramfs.c:824: warning: format '%Ld' expects type 'long long int', but argument 4 has type 'loff_t'
mkfs.cramfs.c:872: warning: format '%d' expects type 'int', but argument 3 has type 'ssize_t'
mkfs.cramfs.c:880: warning: format '%d' expects type 'int', but argument 3 has type 'ssize_t'
mkfs.cramfs.c:885: warning: format '%d' expects type 'int', but argument 3 has type 'long unsigned int'
mkfs.cramfs.c:889: warning: pointer targets in passing argument 2 of 'crc32' differ in signedness
mkfs.cramfs.c:896: warning: format '%Ld' expects type 'long long int', but argument 4 has type 'loff_t'
mkfs.cramfs.c:896: warning: format '%d' expects type 'int', but argument 5 has type 'ssize_t'
mkfs.cramfs.c:909: warning: format '%d' expects type 'int', but argument 4 has type 'ssize_t'
mkfs.cramfs.c:909: warning: format '%d' expects type 'int', but argument 5 has type 'ssize_t'
Co-Author: Karel Zak <kzak@redhat.com> Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Randy Dunlap [Mon, 8 Oct 2007 19:15:25 +0000 (12:15 -0700)]
mount: clean up gcc warnings (mount_mntent.c)
Fix gcc warnings from:
(try compilation with "-Wall -Wp,-D_FORTIFY_SOURCE=2")
mount_mntent.c:28: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
mount_mntent.c:129: warning: pointer targets in passing argument 1 of 'mangle' differ in signedness
mount_mntent.c:130: warning: pointer targets in passing argument 1 of 'mangle' differ in signedness
mount_mntent.c:131: warning: pointer targets in passing argument 1 of 'mangle' differ in signedness
mount_mntent.c:132: warning: pointer targets in passing argument 1 of 'mangle' differ in signedness
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Karel Zak [Fri, 5 Oct 2007 10:22:13 +0000 (12:22 +0200)]
script: dies on SIGWINCH
The "doinput" process doesn't make a difference between SIGWINCH and
SIGCHILD. This process also sends unnecessary SIGWINCH to child (the
signal is ignored by child). Fixed.
chsh: should use pam_end function to terminate the PAM transaction
chsh will use PAM transaction if macros 'REQUIRE_PASSWORD' and
'HAVE_SECURITY_PAM_MISC_H' are defined, but there is no pam_end function be
used when the PAM transaction be terminated.
This patch also cleanup PAM code in chsh(1).
Signed-off-by: Yu Zhiguo <yuzg@cn.fujitsu.com>
Co-Author: Karel Zak <kzak@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Run pg(1) and type '/<CR>' which is supposed to forward search for the
previously remembered search string. pg(1) will segfault after printing
"No remembered search string:".
Signed-off-by: Rajeev V. Pillai <rajeevvp@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
The --rtc option does not set the name of the device correctly.
It still uses /dev/rtc even if the --rtc option is given.
Testcase:
$ mv /dev/rtc /dev/foo
$ hwclock --show --debug --rtc=/dev/foo
hwclock from util-linux-2.13-rc2
Using /dev interface to clock.
Last drift adjustment done at 1190198135 seconds after 1969
Last calibration done at 1190198135 seconds after 1969
Hardware clock is on local time
Assuming hardware clock is kept in local time.
Waiting for clock tick...
hwclock: open() of /dev/rtc failed, errno=2: No such file or directory.
...got clock tick
Co-Author: Karel Zak <kzak@redhat.com> Signed-off-by: Matthias Koenig <mkoenig@suse.de> Signed-off-by: Karel Zak <kzak@redhat.com>
Mike Frysinger [Fri, 7 Sep 2007 00:30:16 +0000 (20:30 -0400)]
build-sys: nls/locale handling in util-linux-ng general
On Monday 03 September 2007, Karel Zak wrote:
> http://thread.gmane.org/gmane.linux.utilities.util-linux-ng/590/focus=592
>
> I agree that we need a better support for compilation without
> locales, but from my point of view NLS != all locales stuff. The NLS
> support is subset only.
thinking about the input from everyone, i'd propose the attached ...
Only pull in locale.h as needed and move it to the common nls.h.
When editing a disk image, fdisk wants to ask the kernel to reread the
partition table which is useless and provokes an error, a wrong exit
code and some waiting. This annoys me as I can't check the return code
in my script and because I have to wait a few seconds each time.
This trivial patch makes it only do the ioctl on block devices.
It also simplifies code by dropping some workaround for kernel 1.2.x
mount: chain of symlinks to fstab causes use of pointer after free
Looking at the source in 'mount/realpath.c' we find that when dealing with
the second or later symlink in the chain, a memory block was free()d before
copying its contents to a newly allocated block.
Karel Zak [Mon, 27 Aug 2007 21:31:25 +0000 (23:31 +0200)]
setarch: add --3gb option fot compatibility with Debian linux{32,64} command
Debian had a pre-existing linux{32,64} command which supported only
--3gb and --4gb. Adding support for those options allows setarch to
replace that package.
(Note that long options are expected for all setarch flags in the next
release.)
Signed-off-by: LaMont Jones <lamont@mmjgroup.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Mon, 27 Aug 2007 11:16:08 +0000 (13:16 +0200)]
Revert "mount: improve error message when helper program not present"
This reverts commit f8988ebf89c65b624ee19c685d15cab6c77fd9df that
breaks new PO translation. The code is currently in "string freeze"
state. The patch will be applied to 2.14 and 2.13.1.
Sascha Sommer [Tue, 21 Aug 2007 13:13:43 +0000 (15:13 +0200)]
mount: free loop device on failure
Testcase:
$ mount -oloop /etc/group /mnt
ioctl: LOOP_CLR_FD: Device or resource busy
mount: you must specify the filesystem type
$ losetup /dev/loop0
/dev/loop0: [0803]:1931929 (/etc/group)
Matthias Koenig [Fri, 24 Aug 2007 11:05:27 +0000 (13:05 +0200)]
mount: avoid duplicates for root fs in mtab
If the root fs is defined with LABEL or UUID in fstab, avoid
a duplicate entry in mtab when calling mount without existing
mtab.
A mount -f / creates two entries, one for LABEL and another
for the devicename, because canonicalize does not expand the
LABEL or UUID tags.
Karel Zak [Tue, 14 Aug 2007 12:32:45 +0000 (14:32 +0200)]
build-sys: add --disable-makeinstall-chown
A chown-like operations are unexpected when you execute "make install"
as non-root user. For example RPM defines owner+permissions in .spec
file -- you needn't to use root account to create useful RPM package.
Karel Zak [Tue, 14 Aug 2007 10:27:55 +0000 (12:27 +0200)]
docs: add README.licensing
There is not only one unique license for all code in utl-linux-ng. We
have mix of utils with Public Domain, BSD, GPLv2 or GPLv2+. This thing
should be more transparent to avoid misunderstanding.
Karel Zak [Tue, 14 Aug 2007 10:04:09 +0000 (12:04 +0200)]
chsh: don't use empty shell field in /etc/passwd
chsh(1) uses empty shell setting (pw->pw_shell="") as a synonym for
/bin/sh. This convention is silly and unnecessary. (The vsftpd server
will not run if the shell assigned to user "ftp" is a null string --
according to bug rh#103004).