dist_bashcompletion_DATA =
check_PROGRAMS =
dist_check_SCRIPTS =
-TESTS =
PATHFILES =
# define UL_ASAN_BLACKLIST /* nothing */
#endif
+
+
+/*
+ * Note that sysconf(_SC_GETPW_R_SIZE_MAX) returns *initial* suggested size for
+ * pwd buffer and in some cases it is not large enough. See POSIX and
+ * getpwnam_r man page for more details.
+ */
+#define UL_GETPW_BUFSIZ (16 * 1024)
+
#endif /* UTIL_LINUX_C_H */
return rc;
}
-static size_t get_pw_record_size(void)
-{
-#ifdef _SC_GETPW_R_SIZE_MAX
- long sz = sysconf(_SC_GETPW_R_SIZE_MAX);
- if (sz > 0)
- return sz;
-#endif
- return 16384;
-}
-
/*
* Returns an allocated string with username or NULL.
*/
{
struct passwd pwd;
struct passwd *res;
- size_t sz = get_pw_record_size();
char *buf, *username = NULL;
- buf = malloc(sz);
+ buf = malloc(UL_GETPW_BUFSIZ);
if (!buf)
return NULL;
- if (!getpwuid_r(uid, &pwd, buf, sz, &res) && res)
+ if (!getpwuid_r(uid, &pwd, buf, UL_GETPW_BUFSIZ, &res) && res)
username = strdup(pwd.pw_name);
free(buf);
int rc = -1;
struct passwd pwd;
struct passwd *pw;
- size_t sz = get_pw_record_size();
char *buf;
if (!username || !uid)
return -EINVAL;
- buf = malloc(sz);
+ buf = malloc(UL_GETPW_BUFSIZ);
if (!buf)
return -ENOMEM;
- if (!getpwnam_r(username, &pwd, buf, sz, &pw) && pw) {
+ if (!getpwnam_r(username, &pwd, buf, UL_GETPW_BUFSIZ, &pw) && pw) {
*uid= pw->pw_uid;
rc = 0;
} else {
int rc = -1;
struct group grp;
struct group *gr;
- size_t sz = get_pw_record_size();
char *buf;
if (!groupname || !gid)
return -EINVAL;
- buf = malloc(sz);
+ buf = malloc(UL_GETPW_BUFSIZ);
if (!buf)
return -ENOMEM;
- if (!getgrnam_r(groupname, &grp, buf, sz, &gr) && gr) {
+ if (!getgrnam_r(groupname, &grp, buf, UL_GETPW_BUFSIZ, &gr) && gr) {
*gid= gr->gr_gid;
rc = 0;
} else {
struct passwd *pwd)
{
struct passwd *res = NULL;
- size_t sz = 16384;
int x;
if (!pwdbuf || !username)
return NULL;
-#ifdef _SC_GETPW_R_SIZE_MAX
- {
- long xsz = sysconf(_SC_GETPW_R_SIZE_MAX);
- if (xsz > 0)
- sz = (size_t) xsz;
- }
-#endif
- *pwdbuf = xrealloc(*pwdbuf, sz);
+ *pwdbuf = xrealloc(*pwdbuf, UL_GETPW_BUFSIZ);
- x = getpwnam_r(username, pwd, *pwdbuf, sz, &res);
+ x = getpwnam_r(username, pwd, *pwdbuf, UL_GETPW_BUFSIZ, &res);
if (!res) {
errno = x;
return NULL;
--- /dev/null
+Checking that no-one is using this disk right now ... OK
+
+Disk <removed>: 50 MiB, 52428800 bytes, 102400 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 4096 bytes
+I/O size (minimum/optimal): 4096 bytes / 32768 bytes
+
+>>> Script header accepted.
+>>> Script header accepted.
+>>> Script header accepted.
+>>> Created a new <removed>.
+Created a new <removed>.
+<removed>2: Created a new <removed>.
+<removed>3: Created a new <removed>.
+<removed>4: Created a new <removed>.
+<removed>5:
+New situation:
+
+Device Start End Sectors Size Type
+<removed>1 8192 14335 6144 3M Linux filesystem
+<removed>2 2048 8191 6144 3M Linux filesystem
+<removed>3 20480 102366 81887 40M Linux filesystem
+<removed>4 14336 20479 6144 3M Linux filesystem
+
+Partition table entries are not in disk order.
+
+The partition table has been altered.
+Calling ioctl() to re-read partition table.
+Syncing disks.
+
+The partition table has been altered.
+Calling ioctl() to re-read partition table.
+Syncing disks.
+Disk <removed>: 50 MiB, 52428800 bytes, 102400 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 4096 bytes
+I/O size (minimum/optimal): 4096 bytes / 32768 bytes
+Disklabel type: gpt
+Disk identifier: <removed>
+
+Device Start End Sectors Size Type
+<removed>1 2048 8191 6144 3M Linux filesystem
+<removed>2 8192 14335 6144 3M Linux filesystem
+<removed>3 14336 20479 6144 3M Linux filesystem
+<removed>4 20480 102366 81887 40M Linux filesystem
ts_check_test_command "$TS_CMD_FDISK"
ts_check_test_command "$TS_CMD_EJECT"
-ts_check_prog "mkfs.ext2"
ts_skip_nonroot
+ts_check_prog "mkfs.ext2"
#
# Note that eject --force is required because scsi_debug is
ts_check_test_command "$TS_CMD_FDISK"
ts_check_test_command "$TS_CMD_MOUNT"
-ts_check_prog "mkfs.ext3"
ts_skip_nonroot
ts_check_losetup
+ts_check_prog "mkfs.ext3"
> $TS_OUTPUT
TS_DESC="limits overflow"
. $TS_TOPDIR/functions.sh
-
ts_init "$*"
ts_check_test_command "$TS_CMD_IPCS"
ts_check_test_command "$TS_CMD_MOUNT"
ts_check_test_command "$TS_CMD_UMOUNT"
ts_check_test_command "$TS_CMD_UUIDGEN"
+
+ts_skip_nonroot
ts_check_prog "mkfs.ext3"
ts_check_prog "mkfs.ext4"
-ts_skip_nonroot
TESTPROG="$TS_HELPER_LIBMOUNT_CONTEXT"
LABEL=libmount-test
UUID=$($TS_CMD_UUIDGEN)
ts_check_test_command "$TS_CMD_MOUNT"
ts_check_test_command "$TS_CMD_UMOUNT"
ts_check_test_command "$TS_CMD_UUIDGEN"
+
+ts_skip_nonroot
ts_check_prog "mkfs.ext3"
ts_check_prog "mkfs.ext4"
ts_init_py libmount
-ts_skip_nonroot
TESTPROG="$TS_HELPER_PYLIBMOUNT_CONTEXT"
[ -x $TESTPROG ] || ts_die "test script missing"
ts_check_test_command "$TS_CMD_FINDMNT"
ts_check_test_command "$TS_CMD_WIPEFS"
ts_check_test_command "$TS_CMD_UUIDGEN"
-ts_check_prog "mkfs.ext4"
+
ts_skip_nonroot
+ts_check_prog "mkfs.ext4"
TESTPROG="$TS_HELPER_LIBMOUNT_CONTEXT"
LABEL=libmount-test
ts_check_test_command "$TS_CMD_FINDMNT"
ts_check_test_command "$TS_CMD_WIPEFS"
ts_check_test_command "$TS_CMD_UUIDGEN"
-ts_check_prog "mkfs.ext4"
-ts_init_py libmount
ts_skip_nonroot
+ts_check_prog "mkfs.ext4"
+ts_init_py libmount
TESTPROG="$TS_HELPER_PYLIBMOUNT_CONTEXT"
[ -x $TESTPROG ] || ts_die "test script missing"
. $TS_TOPDIR/functions.sh
ts_init "$*"
+
ts_skip_nonroot
if [ -f "$ASAN_SYMBOLIZER_PATH" ]; then
. $TS_TOPDIR/functions.sh
ts_init "$*"
-ts_init_py libmount
+
ts_skip_nonroot
+ts_init_py libmount
+
if [ -f "$ASAN_SYMBOLIZER_PATH" ]; then
TS_KNOWN_FAIL="yes"
fi
ts_check_test_command "$TS_CMD_MOUNT"
ts_check_test_command "$TS_CMD_UMOUNT"
-ts_check_prog "mkfs.ext3"
ts_skip_nonroot
ts_check_losetup
+ts_check_prog "mkfs.ext3"
ts_device_init
DEVICE=$TS_LODEV
ts_check_test_command "$TS_CMD_MOUNT"
ts_check_test_command "$TS_CMD_UMOUNT"
-ts_check_prog "mkfs.ext3"
ts_skip_nonroot
ts_check_losetup
+ts_check_prog "mkfs.ext3"
ts_device_init
DEVICE=$TS_LODEV
ts_check_test_command "$TS_CMD_MOUNT"
ts_check_test_command "$TS_CMD_UMOUNT"
-ts_check_prog "mkfs.ext3"
ts_skip_nonroot
ts_check_losetup
+ts_check_prog "mkfs.ext3"
ts_device_init
DEVICE=$TS_LODEV
ts_check_test_command "$TS_CMD_MOUNT"
ts_check_test_command "$TS_CMD_UMOUNT"
-ts_check_prog "mkfs.ext3"
ts_skip_nonroot
ts_check_losetup
+ts_check_prog "mkfs.ext3"
ts_device_init
DEVICE=$TS_LODEV
ts_check_test_command "$TS_CMD_MOUNT"
ts_check_test_command "$TS_CMD_UMOUNT"
-ts_check_prog "mkfs.ext3"
ts_skip_nonroot
ts_check_losetup
+ts_check_prog "mkfs.ext3"
ts_device_init
DEVICE=$TS_LODEV
ts_check_test_command "$TS_CMD_MOUNT"
ts_check_test_command "$TS_CMD_UMOUNT"
-ts_check_prog "mkfs.ext3"
ts_skip_nonroot
ts_check_losetup
+ts_check_prog "mkfs.ext3"
ts_device_init
DEVICE=$TS_LODEV
ts_check_test_command "$TS_CMD_MOUNT"
ts_check_test_command "$TS_CMD_UMOUNT"
-ts_check_prog "mkfs.ext3"
ts_skip_nonroot
ts_check_losetup
+ts_check_prog "mkfs.ext3"
ts_device_init
DEVICE=$TS_LODEV
ts_check_test_command "$TS_CMD_MOUNT"
ts_check_test_command "$TS_CMD_UMOUNT"
-ts_check_prog "mkfs.ext3"
ts_skip_nonroot
ts_check_losetup
+ts_check_prog "mkfs.ext3"
ts_device_init
DEVICE=$TS_LODEV
ts_check_test_command "$TS_CMD_MOUNT"
ts_check_test_command "$TS_CMD_UMOUNT"
-ts_check_prog "mkfs.ext3"
ts_skip_nonroot
ts_check_losetup
+ts_check_prog "mkfs.ext3"
LINKNAME="$TS_OUTDIR/${TS_TESTNAME}_lnk"
ts_check_test_command "$TS_CMD_MOUNT"
ts_check_test_command "$TS_CMD_UMOUNT"
-ts_check_prog "mkfs.ext3"
ts_skip_nonroot
ts_check_losetup
+ts_check_prog "mkfs.ext3"
ts_device_init
DEVICE=$TS_LODEV
ts_check_test_command "$TS_CMD_MOUNT"
ts_check_test_command "$TS_CMD_UMOUNT"
-ts_check_prog "mkfs.ext3"
ts_skip_nonroot
ts_check_losetup
+ts_check_prog "mkfs.ext3"
ts_device_init
DEVICE=$TS_LODEV
ts_check_test_command "$TS_CMD_MOUNT"
ts_check_test_command "$TS_CMD_UMOUNT"
-ts_check_prog "mkfs.ext3"
ts_skip_nonroot
ts_check_losetup
+ts_check_prog "mkfs.ext3"
ts_device_init
DEVICE=$TS_LODEV
ts_check_test_command "$TS_CMD_MOUNT"
ts_check_test_command "$TS_CMD_UMOUNT"
-ts_check_prog "mkfs.ext3"
ts_skip_nonroot
ts_check_losetup
+ts_check_prog "mkfs.ext3"
ts_device_init
DEVICE=$TS_LODEV
ts_check_test_command "$TS_CMD_MOUNT"
ts_check_test_command "$TS_CMD_UMOUNT"
-ts_check_prog "mkfs.ext3"
ts_skip_nonroot
ts_check_losetup
+ts_check_prog "mkfs.ext3"
IMAGE=$(ts_image_init)
mkfs.ext3 -F $IMAGE &> /dev/null || ts_die "Cannot make ext3 on $IMAGE"
ts_check_test_command "$TS_CMD_MOUNT"
ts_check_test_command "$TS_CMD_FINDMNT"
-ts_check_prog "mkfs.ext2"
ts_skip_nonroot
ts_check_losetup
+ts_check_prog "mkfs.ext2"
# mountpoint
[ -d $TS_MOUNTPOINT ] || mkdir -p $TS_MOUNTPOINT
ts_check_test_command "$TS_CMD_MOUNT"
ts_check_test_command "$TS_CMD_UMOUNT"
-ts_check_prog "mkfs.ext3"
ts_skip_nonroot
ts_check_losetup
+ts_check_prog "mkfs.ext3"
[ -L /etc/mtab ] && ts_skip "mtab is symlink"
[ "$(stat --format '%s' /etc/mtab)" -gt "1024" ] || ts_skip "mtab is too small"
ts_check_test_command "$TS_CMD_MOUNT"
ts_check_test_command "$TS_CMD_UMOUNT"
ts_check_test_command "$TS_CMD_FINDMNT"
-ts_check_prog "mkfs.ext3"
ts_skip_nonroot
ts_check_losetup
+ts_check_prog "mkfs.ext3"
[ -d $TS_MOUNTPOINT ] || mkdir -p $TS_MOUNTPOINT
ts_check_test_command "$TS_CMD_MOUNT"
ts_check_test_command "$TS_CMD_UMOUNT"
ts_check_test_command "$TS_CMD_FDISK"
-ts_check_prog "mkfs.ext2"
ts_skip_nonroot
+ts_check_prog "mkfs.ext2"
$TS_CMD_UMOUNT --help | grep -q all-targets
[ $? -eq 1 ] && ts_skip "all-targets unsupported"
ts_check_test_command "$TS_CMD_MOUNT"
ts_check_test_command "$TS_CMD_UMOUNT"
ts_check_test_command "$TS_CMD_FDISK"
-ts_check_prog "mkfs.ext2"
ts_skip_nonroot
+ts_check_prog "mkfs.ext2"
$TS_CMD_UMOUNT --help | grep -q recursive
[ $? -eq 1 ] && ts_skip "recursive unsupported"
ts_check_test_command "$TS_CMD_MOUNT"
ts_check_test_command "$TS_CMD_UMOUNT"
-ts_check_prog "mkfs.ext3"
ts_skip_nonroot
ts_check_losetup
+ts_check_prog "mkfs.ext3"
ts_device_init
DEVICE=$TS_LODEV
PARTS=3
. $TS_TOPDIR/functions.sh
-ts_check_prog "xz"
-
ts_init "$*"
ts_check_test_command "$TS_CMD_PARTX"
ts_check_test_command "$TS_CMD_DELPART"
ts_skip_nonroot
+ts_check_prog "xz"
mkdir -p $TS_OUTDIR/images-pt
for img in $(ls $TS_IMGDIR/*.img.xz | sort); do
ts_check_test_command "$TS_CMD_SFDISK"
ts_skip_nonroot
+ts_check_prog "mkfs.ext4"
# set global variable TS_DEVICE
ts_scsi_debug_init dev_size_mb=100 sector_size=512