[PATCH] overlay: deprecate test t_truncate_self

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Since kernel commit 2a010c412853 ("fs: don't block i_writecount during
exec"), truncating an executable file while it is being executed is
allowed. Therefore, the test t_truncate_self now fails, so remove it.

Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx>
---

Zorro,

This is a fix for a test regression since v6.11-rc1.
My fix is to deprecate the test, because the change of behavior is
desired (at least until a non test user complains).

Thanks,
Amir.

 .gitignore            |  1 -
 src/Makefile          |  2 +-
 src/t_truncate_self.c | 26 --------------------------
 tests/overlay/013     | 41 -----------------------------------------
 tests/overlay/013.out |  2 --
 5 files changed, 1 insertion(+), 71 deletions(-)
 delete mode 100644 src/t_truncate_self.c
 delete mode 100755 tests/overlay/013
 delete mode 100644 tests/overlay/013.out

diff --git a/.gitignore b/.gitignore
index 36083e9d..94f6b564 100644
--- a/.gitignore
+++ b/.gitignore
@@ -171,7 +171,6 @@ tags
 /src/t_snapshot_deleted_subvolume
 /src/t_stripealign
 /src/t_truncate_cmtime
-/src/t_truncate_self
 /src/test-nextquota
 /src/testx
 /src/trunc
diff --git a/src/Makefile b/src/Makefile
index b3da59a0..52299b4c 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -13,7 +13,7 @@ TARGETS = dirstress fill fill2 getpagesize holes lstat64 \
 	godown resvtest writemod writev_on_pagefault makeextents itrash rename \
 	multi_open_unlink unwritten_sync genhashnames t_holes \
 	t_mmap_writev t_truncate_cmtime dirhash_collide t_rename_overwrite \
-	holetest t_truncate_self af_unix t_mmap_stale_pmd \
+	holetest af_unix t_mmap_stale_pmd \
 	t_mmap_cow_race t_mmap_fallocate fsync-err t_mmap_write_ro \
 	t_ext4_dax_journal_corruption t_ext4_dax_inline_corruption \
 	t_ofd_locks t_mmap_collision mmap-write-concurrent \
diff --git a/src/t_truncate_self.c b/src/t_truncate_self.c
deleted file mode 100644
index a11f7d5a..00000000
--- a/src/t_truncate_self.c
+++ /dev/null
@@ -1,26 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <unistd.h>
-#include <libgen.h>
-
-int main(int argc, char *argv[])
-{
-	const char *progname = basename(argv[0]);
-	int ret;
-
-	ret = truncate(argv[0], 4096);
-	if (ret != -1) {
-		if (argc == 2 && strcmp(argv[1], "--may-succeed") == 0)
-			return 0;
-		fprintf(stderr, "truncate(%s) should have failed\n",
-			progname);
-		return 1;
-	}
-	if (errno != ETXTBSY) {
-		perror(progname);
-		return 1;
-	}
-
-	return 0;
-}
diff --git a/tests/overlay/013 b/tests/overlay/013
deleted file mode 100755
index 73c72c30..00000000
--- a/tests/overlay/013
+++ /dev/null
@@ -1,41 +0,0 @@
-#! /bin/bash
-# SPDX-License-Identifier: GPL-2.0
-# Copyright (c) 2016 Red Hat Inc.  All Rights Reserved.
-#
-# FS QA Test 013
-#
-# Test truncate running executable binaries from lower and upper dirs.
-# truncate(2) should return ETXTBSY, not other errno nor segfault
-#
-# Commit 03bea6040932 ("ovl: get_write_access() in truncate") fixed this issue.
-. ./common/preamble
-_begin_fstest auto quick copyup
-
-# Import common functions.
-. ./common/filter
-
-_require_scratch
-_require_test_program "t_truncate_self"
-
-# remove all files from previous runs
-_scratch_mkfs
-
-# copy test program to lower and upper dir
-lowerdir=$OVL_BASE_SCRATCH_MNT/$OVL_LOWER
-upperdir=$OVL_BASE_SCRATCH_MNT/$OVL_UPPER
-mkdir -p $lowerdir
-mkdir -p $upperdir
-cp $here/src/t_truncate_self $lowerdir/test_lower
-cp $here/src/t_truncate_self $upperdir/test_upper
-
-_scratch_mount
-
-# run test program from lower and upper dir
-# test programs truncate themselfs, all should fail with ETXTBSY
-$SCRATCH_MNT/test_lower --may-succeed
-$SCRATCH_MNT/test_upper
-
-# success, all done
-echo "Silence is golden"
-status=0
-exit
diff --git a/tests/overlay/013.out b/tests/overlay/013.out
deleted file mode 100644
index 3e66423b..00000000
--- a/tests/overlay/013.out
+++ /dev/null
@@ -1,2 +0,0 @@
-QA output created by 013
-Silence is golden
-- 
2.34.1





[Index of Archives]     [Linux Filesystems Devel]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux