Commit Graph

12975 Commits

Author SHA1 Message Date
Karel Zak cdd538e383 agetty: don't use __u32
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-10-11 14:22:08 +02:00
Karel Zak 056a370efb agetty: make output more robust
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-10-11 13:29:39 +02:00
Karel Zak 980a6e431c agetty: cleanup issue output change, remove bool
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-10-11 13:21:23 +02:00
Karel Zak ddbb3067b6 agetty: move all issue variables to struct
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-10-11 13:12:02 +02:00
Stanislav Brabec 6522d88d08 agetty: Reload only if it is really needed
If netlink event arrives and related escapes are part of issue, agetty
reloads and re-display the prompt. Reload is triggered not only by IP
address change, but also by IPv6 RAs. In some environments it causes
reload several times in a minute, and even complicates the login.

To prevent this, reload only if a real change appears.

This consists of:
split print_issue_file() to several functions:

eval_issue_file() prints issue to memory. It does not affect terminal in
any way.

print_issue_file() prints issue file from memory.

cmp_issue_file() compares the issue file and returns true, if reload is
needed.

The implementation requires additional change:

do_prompt() does not evaluate the issue file. It is responsibility of
calling function.

Test suite:

Use issue that contais \4 and/or \6 escape.

After installing new instance, restart agetty by typing a letter and then
Enter 6 times.

To check whether reload happens, type a letter. When reload happens,
letter disappears.

1. Unplug network cable. Wait a while and re-plug network cable.
You should see 2 reloads on single stack and 3 reloads on dual stack.

2. Run a loop
while : ; do
	sed -i '$areload_test' /etc/issue
	agetty --reload
	sleep 3
	sed -i '/reload_test/d' /etc/issue
	agetty --reload
	sleep 3
done
You should see regular reload every 3 seconds.

3. Run a loop
while : ; do
	agetty --reload
	sleep 3
done
Before: You see regular reload every 3 seconds.
After: No reloads.

4. Run a loop
while : ; do
	ifconfig lo 127.0.0.1 netmask 255.0.0.0
	sleep 3
	ifconfig lo 127.0.0.2 netmask 255.0.0.0
	sleep 3
done
Before: You see regular reload every 3 seconds.
After: No reloads.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
2018-10-11 12:09:25 +02:00
Stanislav Brabec 36c55a8987 agetty: Watch only protocol requested by issue escapes
To decrease number of reloads, watch only protocol requested by \4 and \6
escapes in issue file.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
2018-10-11 12:09:25 +02:00
Stanislav Brabec c5955394a8 agetty: rename variable changed to triggered
changed variable name is not correct. It does not say that network
interface changed its address. It just says that the netlink message
processing was triggered.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
2018-10-11 12:09:25 +02:00
Karel Zak d482a0bd5c bash-completion: cleanup mount and umount --namespace
* use only PATHs rather than PIDs to namespaces

* add --namespace to umount too

Signed-off-by: Karel Zak <kzak@redhat.com>
2018-10-05 11:48:04 +02:00
Karel Zak 4c8a88dcce Merge branch '2018wk40' of https://github.com/kerolasa/util-linux
* '2018wk40' of https://github.com/kerolasa/util-linux:
  bash-completion: catch up with option changes
2018-10-05 11:42:59 +02:00
Karel Zak 4f7acf32b5 libmount: keep namespaces support optional
Reported-by: Ruediger Meier <sweet_f_a@gmx.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-10-05 11:35:45 +02:00
Karel Zak 7a3b35b966 build-sys: add USE_LIBMOUNT_SUPPORT_NAMESPACES
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-10-05 11:02:26 +02:00
Sami Kerola 5feae697b0
bash-completion: catch up with option changes
Check what has changed in usage functions in between v2.32..a77bd80d5 and
update bash-completion files accordingly.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2018-10-04 21:36:22 +01:00
Karel Zak a77bd80d5a sfdisk: disable --activate for Hybrid GPT/MBR
Addresses: https://github.com/karelzak/util-linux/issues/699
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-10-04 14:06:45 +02:00
Karel Zak b4601f620c docs: add getopt to TODO
Addresses: https://github.com/karelzak/util-linux/issues/701
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-10-04 12:54:05 +02:00
Karel Zak 49032ef7a4 sfdisk: be more verbose about PMBR on --activate
Addresses: https://github.com/karelzak/util-linux/issues/699
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-10-04 12:40:10 +02:00
Patrick Steinhardt d2523d3dd2 rename: avoid undefined function prototype for `fpurge`
In case where the non-standard `fpurge` function is available, we
redefine `__fpurge` to `fpurge`. We can do so because the only
difference between both functions is that one returns an error code
while the other does not. But as we do not check the error code either
way, we do not care about which one of them we use.

The above redefinition happens unconditionally if we know that `fpurge`
exists. Most notably, we also redefine it if we already do have an
`__fpurge` function available that could be used. This causes problems
on musl-based platforms, where we detect availability of `fpurge` in
libc, but where no function declaration for it exists in "stdio_ext.h".
The compiler thus prints a warning due to an unknown function, even
though it will link just fine.

Avoid this warning by only redefining `__fpurge` to `fpurge` when
HAVE___FPURGE is not defined.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
2018-10-04 11:56:37 +02:00
Patrick Steinhardt 6529212d5b lsblk: fix unknown type `stat` caused by missing header
The structure `blkdev_cxt` has a `struct stat` member embedded, whose
size may not be known on some systems because of a missing include for
"sys/stat.h". On glibc-based systems, this header is included
transitively via "sys/statvfs.h", but on musl-based systems it is not.

Fix the resulting compile error due to unknown size of the struct by
including "sys/stat.h".

Signed-off-by: Patrick Steinhardt <ps@pks.im>
2018-10-04 11:56:35 +02:00
Ruediger Meier 7a715f731a libfdisk: fix printf format modifier
libfdisk/src/script.c: In function ‘fdisk_script_read_context’:
libfdisk/src/script.c:452:33: error: format ‘%zu’ expects argument of type ‘size_t’, but argument 4 has type ‘long unsigned int’ [-Werror=format=]
   snprintf(buf, sizeof(buf), "%zu", fdisk_get_grain_size(cxt));
                                 ^

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2018-10-04 11:56:25 +02:00
Ruediger Meier e5e3a87cdb libfdisk: fix OSX compiler warning
libfdisk/src/context.c:1354:54: error: unused parameter 'cxt' [-Werror,-Wunused-parameter]
const char *fdisk_get_devmodel(struct fdisk_context *cxt)

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2018-10-04 11:56:22 +02:00
Karel Zak c0c4feec88 agetty: cleanup code to copy to log strings
man utmp:
  String fields are terminated by a null byte ('\0') if they are shorter
  than the size of the field.

Signed-off-by: Karel Zak <kzak@redhat.com>
2018-10-03 17:10:44 +02:00
Karel Zak 7f76bc8a75 su: cleanup code to copy to log strings
man utmp:
  String fields are terminated by a null byte ('\0') if they are shorter
  than the size of the field.

Signed-off-by: Karel Zak <kzak@redhat.com>
2018-10-03 17:10:13 +02:00
Karel Zak ac5c12fdc2 login: cleanup code to copy to log strings
man utmp:
  String fields are terminated by a null byte ('\0') if they are shorter
  than the size of the field.

Signed-off-by: Karel Zak <kzak@redhat.com>
2018-10-03 17:08:11 +02:00
Karel Zak 561472a40d mkfs.cramfs: properly copy disk name
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-10-03 17:07:37 +02:00
Karel Zak 22fbfdb8f5 last: make sure domain is zero terminated
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-10-03 17:06:33 +02:00
Karel Zak 0b6bb91adf wall: make sure line is zero terminated
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-10-03 17:06:12 +02:00
Karel Zak a338eb4a46 include/c: add str2memcpy() and mem2strcpy()
str2memcpy() - copy zero terminated string to optionally terminated buffer

mem2strcpy() - copy from buffer to zero terminated string

Signed-off-by: Karel Zak <kzak@redhat.com>
2018-10-03 17:03:11 +02:00
Sevan Janiyan 671295131e include/ttyutils: define values if missing.
Upstreamed from pkgsrc.

Addresses: https://github.com/karelzak/util-linux/pull/695
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-10-03 15:43:45 +02:00
Sevan Janiyan 7d5976f89a include/c: add NAME_MAX compat
Upstreamed from pkgsrc.

Addresses: https://github.com/karelzak/util-linux/pull/695
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-10-03 15:43:36 +02:00
Karel Zak ef2ce68b1f lsblk: always use "part" as TYPE for partitions
The current code uses "part" or "disk" only if nothing else is
possible to recognize. It means for example partitions on loops (or
RAIDs, etc) are marked as "loop" rather than "part".

Addresses: https://github.com/karelzak/util-linux/issues/700
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-10-03 14:39:57 +02:00
Karel Zak f1a7a86d1b mount: add note about MS_BIND and _netdev
Addresses: https://github.com/karelzak/util-linux/issues/697
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-10-02 12:50:40 +02:00
Karel Zak ed02256387 build-sys: release++ (v2.33-rc1)
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-09-25 11:26:58 +02:00
Karel Zak 99c92a4820 tests: add choom to build-sys test
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-09-24 11:37:13 +02:00
Karel Zak 71c7d37bc4 docs: fix gtkdoc warning
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-09-24 11:21:09 +02:00
Karel Zak 78686983e0 docs: update v2.33-ReleaseNotes
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-09-20 14:27:55 +02:00
Karel Zak 027ee85a1b docs: update AUTHORS file
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-09-20 12:19:06 +02:00
Karel Zak 251e171e51 po: merge changes
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-09-19 12:54:05 +02:00
Sebastian Rasmussen f0afad3164 po: update sv.po (from translationproject.org) 2018-09-19 12:49:46 +02:00
Rafael Fontenelle 395557fa04 po: update pt_BR.po (from translationproject.org) 2018-09-19 12:49:46 +02:00
Takeshi Hamasaki 91730da15b po: update ja.po (from translationproject.org) 2018-09-19 12:49:46 +02:00
Karel Zak ab295603e9 libfdisk: (docs) add missing function
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-09-19 12:00:59 +02:00
Karel Zak ccafadb7c5 lsblk: move udev and blkid stuff to lsblk-properties.c
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-09-19 11:40:17 +02:00
Karel Zak baad6dcc6e lsblk: cleanup udev/blkid properties code
* split properties to separate struct which is allocated only when
  udev or blkid provides some information

* use separate function for udev and blkid and hide details in generic
  get_device_properties()

* make sure we do not overwrite stuff udev and blkid (but this is only
  theoretic issue as we do not call get_properties_by_blkid() directly
  from code)

Signed-off-by: Karel Zak <kzak@redhat.com>
2018-09-19 11:40:17 +02:00
Karel Zak a1b463d94a tests: update sfdisk resize
due to 2f35c1ead6

Signed-off-by: Karel Zak <kzak@redhat.com>
2018-09-17 16:22:14 +02:00
Karel Zak 2f35c1ead6 libfdisk: count gaps to possible size when resize
The current code counts only partition sizes when it counts possible
space, but we have gaps between the partitions. It seems better to
count all based on offsets rather than sizes.

Addresses: https://github.com/karelzak/util-linux/issues/693
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-09-17 11:58:50 +02:00
Karel Zak 652cb1cd26 lsblk: encapsulate stat() usage
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-09-14 16:27:26 +02:00
Karel Zak 5b82289b60 lib/strutils: return from xstrmode()
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-09-14 16:26:38 +02:00
Karel Zak 82dae67d1a lsblk: differentiate between swap and mount
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-09-14 15:57:45 +02:00
Karel Zak 04be258d65 lsblk: use lsblk_ prefix mountpoint getter
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-09-14 15:49:00 +02:00
Karel Zak e0c016f11b lsblk: init/deinit libmount stuff
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-09-14 15:45:53 +02:00
Karel Zak cfb715ed1d lsblk: move mount stuff to lsblk-mnt.c
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-09-14 15:41:39 +02:00