Commit Graph

5031 Commits

Author SHA1 Message Date
Karel Zak e26de525e2 mount: (new) allow sloppy for non-root
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=825836
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-14 14:43:21 +02:00
Karel Zak e90e7401d0 libmount: don't use nosuid,noexec,nodev for cifs user=foo
mount -t cifs //127.0.0.1/users /mnt/smb -o user=root,password=linux

is incorrectly translated to

   mount.cifs -o noexec,nosuid,nodev,user=root,password=linux ...

The command mount(8) should be sensitive to "user" (without "=<name>")
only. The correct cifs command line is:

   mount.cifs -o user=root,password=linux

Addresses: https://bugzilla.novell.com/show_bug.cgi?id=766157
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-14 14:19:26 +02:00
Karel Zak 6b741564d8 libmount: don't generate empty option strings
mount -t foo something /mnt/test -o user=root,password=linux

generates

 "rw,noexec,nosuid,nodev,password=linux,,user=root"

options string for /sbin/mount.foo, the ",," is incorrect.

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-14 11:38:53 +02:00
Karel Zak 8cd48d67f4 eject: cleanup umount code
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-13 15:58:16 +02:00
Karel Zak 8388bbb3df eject: don't try to use non-device path
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-13 13:55:49 +02:00
Karel Zak 566cd92c9f eject: add --no-partitions-unmount
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-13 13:46:24 +02:00
Karel Zak b5c6f48631 tools: add small and stupid script to check HAVE_DECL_
use 'make checkdecl' to run the script

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-13 11:59:29 +02:00
Karel Zak a01e15f1e4 libblkid: trust in udev symlinks, don't verify
The libblkid always verify that /dev/disk/by-* symlinks match with
on-device LABELs/UUIDs. It means that all requests (e.g. mount -L |
-U) generates extra superblocks scans on the device.

Currently, many users and tools (GNOME, systemd, ...etc) use the
symlink directly and udev maintains the symlinks by inotify (+watch
rule). It seems better for system performance to disable the extra
paranoid mode and trust in udev.

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-12 16:31:39 +02:00
Karel Zak e4062c72d1 losetup: improve -a to report loopdevs < 512 bytes
# ll ~/xxx2
  -rw-r--r-- 1 root root 500 Jun 12 14:30 /root/xxx2

 old version:
  # losetup -a

 new version:
  # losetup -a
  /dev/loop0: [2052]:535312 (/root/xxx2)

The new version scans /sys/block/loopN, kernel >= 2.6.37 is required
otherwise fallback to the original not-so-smart /proc/partitions scan.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=730266
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-12 15:41:47 +02:00
Karel Zak 3554545636 losetup: warn about backing file size
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=730266
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-12 14:34:16 +02:00
Karel Zak 0e60bc9b15 build-sys: add compiler warnings
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-06 12:10:41 +02:00
Karel Zak df68ccd8b8 fdisk: fix io_size usage in new API
properly implemented fdisk_dev_has_topology() requires optimal
I/O size to detect that the device provides topology.

Unfortunately, currently used cxt->io_size maybe overwritten in
__discover_topology() to min_io_size.

This patch introduces cxt->optimal_io_size and keeps it independent on
cxt->io_size. The cxt->io_size is I/O size used by fdisk for alignment
calculation.

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-06 11:03:23 +02:00
Karel Zak dde32b6ccd fdisk: fix compiler warning [-Wunused-variable]
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-06 10:56:29 +02:00
Karel Zak c04e4a6a20 fdisk: fix compiler warning [-Wpointer-sign]
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-06 10:53:20 +02:00
Karel Zak e1fc87eacd fdisk: fix compiler warnings [-Wsign-compare]
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-06 10:48:26 +02:00
Davidlohr Bueso 14e93ff3c8 fdisk: remove user specified sector size global variable
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2012-06-06 10:43:27 +02:00
Davidlohr Bueso 6e89f25e8b fdisk: add fdisk_dev_sectsz_is_default helper
Instead of printing this warning from the API, add a helper and call it from
fdisk logic.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2012-06-06 10:41:51 +02:00
Davidlohr Bueso 3e3de41ad9 fdisk: use EXIT_SUCCESS for -l option
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2012-06-06 10:41:38 +02:00
Davidlohr Bueso 618882d609 fdisk: add total sectors
Add the total_sectors variable to the context structure. This is the initial
geometry information.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2012-06-06 10:40:40 +02:00
Davidlohr Bueso e53ced85bf fdisk: add device topology to the API
This patch adds device topology discovery to the internal API. This
functionality is static only to the API and therefore hidden from general fdisk
code. Functionality itself doesn't really change, min_io_size, io_size, logical
and physical sector sizes and alignment offset are added to the fdisk_context
structure and elements are accessed from there. The logical sector size
(sector_size) is now unsigned long instead of unsigned int, this as no effect
otherwise.

A few things to notice:
 - The patch is larger than I wanted but we need to modify function parameters
   across fdisk and its labels to use the topology data from cxt-> instances.
   Hopefully this will be pretty much it regarding this kind of modifications -
   perhaps geometry will need something of the like too.

 - The -b option must override internal discovery.

 - A new helper function has added to verify if the device provides topology
   information, this replaces the 'has_topology' global variable.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2012-06-06 10:30:07 +02:00
Davidlohr Bueso 7db8141571 fdisk: sun: use sector_t
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2012-06-06 10:12:05 +02:00
Davidlohr Bueso c9d7e0140f fdisk: sgi: use sector_t
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2012-06-06 10:12:01 +02:00
Davidlohr Bueso 24def09df4 fdisk: dos: use sector_t
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2012-06-06 10:11:58 +02:00
Davidlohr Bueso 50dec1ebff fdisk: introduce sector_t type
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2012-06-06 10:11:54 +02:00
Davidlohr Bueso d8de095530 fdisk: remove useless comments
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2012-06-06 10:11:47 +02:00
Davidlohr Bueso 7737f69850 fdisk: use context as a parameter
This program heavily uses global variables, which isn't very elegant and can
lead to nasty bugs. Modify functions that use fdisk's context current features
(descriptor and path), to receive the context as a parameter instead of
globally. This includes DOS, SUN, SGI and BSD label code. Another benefit that
comes with this is that as the API grows all the information regarding fdisk
will be accessible from this structure so we can reduce even more global
variables and simply code.

This patch passed:
 - building
 - regression tests
 - local dos/sun/bsd partition changes

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2012-06-06 10:11:41 +02:00
Davidlohr Bueso 89fd812fcb fdisk: stop buffering welcome message
Recently, commit 0a86755fe8 directed the welcome
message output from stderr to stdout breaking regression tests.  Correct this
by flushing stdout and stop buffering the output - a trivial function is
created as well.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2012-06-06 10:11:22 +02:00
Karel Zak d07dc5e4ee build-sys: suid su in make install
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-05 17:38:09 +02:00
Karel Zak 7d18972b00 login: fix compiler warning [-Wsign-compare]
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-05 16:59:54 +02:00
Karel Zak abb53be5cb Merge branch '2012wk22' of git://github.com/kerolasa/lelux-utiliteetit
* '2012wk22' of git://github.com/kerolasa/lelux-utiliteetit:
  docs: clean up getopt.1 manual
  docs: clean up dmesg.1 manual
  docs: clean up chcpu.8 manual
  fileutils: xmkstemp() interface change
  docs: fix all man page groff warnings
  tools: add checkmans.sh
  docs: clean up wdctl.8 manual
  docs: clean up login.1 manual
  login: allow TTYGROUP name begin by number
  build-sys: add su executable to .gitignore
  logindefs: change getlogindefs_num() to return unsigned long

Conflicts:
	login-utils/su.c
	sys-utils/dmesg.1
2012-06-05 16:57:01 +02:00
Ludwig Nussel 8ce7dfa341 su: preserve errno in cleanup_pam()
Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de>
2012-06-05 15:51:26 +02:00
Karel Zak 90af3fe39b inclide/env: innclude c.h, remove _() macro from xsetenv()
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-05 15:44:12 +02:00
Dave Reisner 5e7b834002 libmount: trim leading commas from each options string
Fixes a bug in option string parsing wherein a line such as:

  ro,relatime,,nosuid,nodev

Will be seen as only the tokens "ro" and "relatime" after the parser
encounters a zero length (and erroneously declared NULL) option.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-06-05 15:40:11 +02:00
Dave Reisner 9d20b49607 build-sys: include correct source file for chsh
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-06-05 15:39:54 +02:00
Ludwig Nussel a9a8b2c4f4 su: use BSD err function instead of gnu's error()
Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de>
2012-06-05 15:20:08 +02:00
Ludwig Nussel 1ecb6186c5 su: remove unused code
Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de>
2012-06-05 15:19:09 +02:00
Ludwig Nussel e824086bbd su: replace PAM_BAIL_P macro with better solution
Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de>
2012-06-05 15:16:27 +02:00
Ludwig Nussel e557efdedd su: introduce xsetenv globally
Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de>
2012-06-05 15:16:18 +02:00
Ludwig Nussel a711e67a44 su: use ENV_PATH resp ENV_SUPATH to be consistent with login
Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de>
2012-06-05 15:16:10 +02:00
Ludwig Nussel 07ffbaf2b0 su: use EXIT_FAILURE consistently
Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de>
2012-06-05 15:16:03 +02:00
Ludwig Nussel 8aa108ff47 su: don't use custom MAX macro
Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de>
2012-06-05 15:15:56 +02:00
Milan Broz cbc729f030 libblkid: add dm-verity hash device detection
dm-verity can use separate device for hash verification,
in this case there is a superblock in the first sector.

See
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=Documentation/device-mapper/verity.txt
for more info.

Signed-off-by: Milan Broz <mbroz@redhat.com>
2012-06-05 14:55:55 +02:00
maximilian attems ab65d635c8 lib/strutils: circumvent missing localeconv()
Add stub too nls.h, include it instead of locale.h.
Code in strutils handles already returned NULL.

Signed-off-by: maximilian attems <max@stro.at>
2012-06-05 14:54:12 +02:00
Karel Zak e7b976862a Merge branch 'su.1' of https://github.com/kerolasa/lelux-utiliteetit
* 'su.1' of https://github.com/kerolasa/lelux-utiliteetit:
  docs: rewrite su.1 manual
  docs: fix email macro in manual example
  docs: add su.1 manual page
2012-06-05 14:47:00 +02:00
Karel Zak a862a45210 dmesg: fix typo in man page
Reported-by: Hemant Borole <hemantborole@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-05 14:40:10 +02:00
Bernhard Voelker 871ffd0960 Fix typos in comments and wall's man page
Culprits identified again by (newer) misspellings:

  $ git ls-files | misspellings -f - | grep -v '^po/'

* wall: Fix typo in man page.
* Fix typos in source code comments.

Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>
2012-06-05 14:37:26 +02:00
Andreas Bießmann 3339f0daab text-utils/hexsyntax.c: fix for missing program_invocation_short_name
Some libc do not expose program_invocation_short_name. Therefore util-linux
comes with helpers in 'c.h'. Use the 'c.h' in hexsyntax.c where it was missed.

This patch fixes following error for me:
---8<---
hexsyntax.c: In function 'newsyntax':
hexsyntax.c:115: error: 'program_invocation_short_name' undeclared (first use in this function)
hexsyntax.c:115: error: (Each undeclared identifier is reported only once
hexsyntax.c:115: error: for each function it appears in.)
--->8---

Signed-off-by: Andreas Bießmann <biessmann@corscience.de>
2012-06-05 14:31:13 +02:00
Karel Zak eecbb2cfee more: fix regex error messages printing
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-05 14:19:13 +02:00
Jeremy Huntwork 7f84e4440f more: remove a meaningless test
regexec only returns 0 or REG_NOMATCH so remove a meaningless test

Signed-off-by: Jeremy Huntwork <jhuntwork@lightcubesolutions.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-05 14:09:36 +02:00
Sami Kerola 00388ebc7b docs: clean up getopt.1 manual
* Add lightness to synopsis.
* Add spaces after dots (English spacing).
* Replace backticks by ticks.
* Reformat text to be 70 characters wide.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-06-02 22:39:40 +02:00