From a4727c90a86162c54aa0ce8a79d0b662345fbcda Mon Sep 17 00:00:00 2001 From: Jean-Adrien DOMAGE Date: Tue, 13 Apr 2021 16:55:07 +0200 Subject: [PATCH] lx_fs: add os/run/lx_fs_import.run run script This new runscript demonstrates how a file can be overwritten by vfs import with the flag overwrite set to false. This is due to a bug in lx_fs that is not propagating an ernno EEXIST syscall error. Issue genodelabs#4104 --- repos/os/run/lx_fs_import.run | 124 ++++++++++++++++++++++++++++++++++ tool/autopilot.list | 1 + 2 files changed, 125 insertions(+) create mode 100644 repos/os/run/lx_fs_import.run diff --git a/repos/os/run/lx_fs_import.run b/repos/os/run/lx_fs_import.run new file mode 100644 index 0000000000..13a73b26e1 --- /dev/null +++ b/repos/os/run/lx_fs_import.run @@ -0,0 +1,124 @@ +assert_spec linux + +set depot_archives { } +set build_components { } +set boot_modules { } + +lappend depot_archives [depot_user]/src/[base_src] +lappend depot_archives [depot_user]/src/init +lappend depot_archives [depot_user]/src/vfs +lappend depot_archives [depot_user]/src/vfs_import + +if { [get_cmd_switch --autopilot] } { + lappend depot_archives [depot_user]/src/lx_fs +} else { + lappend build_components server/lx_fs + lappend boot_modules lx_fs +} + +set config { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Hello Friend! + + + bar + + + bar + + + + + + + + + + + +} + +create_boot_directory +install_config $config + +import_from_depot $depot_archives + +if { [llength $build_components] > 0 } { + build $build_components +} + +build_boot_image $boot_modules + +## Create files before genode is run +exec mkdir -p [run_dir]/genode/test-existing-file +exec echo "This file already exist." > [run_dir]/genode/test-existing-file/a_file +exec mkdir -p [run_dir]/genode/test-existing-directory + +append qemu_args " -nographic " + +run_genode_until "Warning: skipping copy of file /test-existing-file/a_file, OPEN_ERR_EXISTS" 20 + +set created_file { [run_dir]/genode/test-file/foo } + +if { [file exists $created_file] == 1 } { + puts { "Imported file not found." } + exit 1 +} + +set created_file_in_dir { [run_dir]/genode/test-existing-directory/foo } + +if { [file exists $created_file] == 1 } { + puts { "Imported file not found." } + exit 1 +} + diff --git a/tool/autopilot.list b/tool/autopilot.list index 2daf1e938d..176ebf5def 100644 --- a/tool/autopilot.list +++ b/tool/autopilot.list @@ -25,6 +25,7 @@ lwip lx_hybrid_ctors lx_hybrid_exception lx_hybrid_pthread_ipc +lx_fs_import microcode migrate moon