Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
vnotepad
Exa
提交
456c516b
E
Exa
项目概览
vnotepad
/
Exa
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
Exa
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
456c516b
编写于
9月 03, 2015
作者:
B
Ben S
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add script to generate awkward testcases
上级
eee49ece
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
120 addition
and
0 deletion
+120
-0
.gitignore
.gitignore
+1
-0
generate-testcases.sh
generate-testcases.sh
+119
-0
未找到文件。
.gitignore
浏览文件 @
456c516b
*~
target
testcases
generate-testcases.sh
0 → 100755
浏览文件 @
456c516b
#!/bin/bash
# This is a script to generate "awkward" files and directories as test cases,
# to check that exa can actually handle them: symlinks that point at
# themselves, directories that you aren't allowed to view, files with strange
# extended attributes, that sort of thing.
## -- configuration --
# Directory that the files should be generated in.
DIR
=
testcases
if
[[
-e
"
$DIR
"
]]
then
echo
"'
$DIR
' already exists - aborting"
>
&2
exit
2
fi
# You! Yes, you, the name of the user running this script.
YOU
=
`
whoami
`
# Someone with *higher* privileges than yourself, such as root.
ROOT
=
root
# A UID that doesn't map to any user on the system.
INVALID_UID
=
666
# A GID that doesn't map to any group on the system.
INVALID_GID
=
616
# List commands as they are run
# set -x
# Abort on any error!
abort
()
{
echo
'Hit an error - aborting'
>
&2
;
exit
1
;
}
trap
'abort'
ERR
# Get confirmation from the user before running.
# echo "This script will generate files into the $DIR directory."
# echo "It requires sudo for the '$ROOT' user."
# echo "You probably want to edit this file before running it."
# read -r -p "Continue? [y/N] " response
# if [[ ! $response =~ ^([yY][eE][sS]|[yY])$ ]]
# then
# exit 2
# fi
mkdir
"
$DIR
"
## -- links --
mkdir
"
$DIR
/links"
ln
-s
/
"
$DIR
/links/root"
ln
-s
/usr
"
$DIR
/links/usr"
ln
-s
nowhere
"
$DIR
/links/broken"
## -- users and groups --
mkdir
"
$DIR
/passwd"
# sudo is needed for these because we technically aren't a member of the
# groups (because they don't exist), and chown and chgrp are smart enough to
# disallow it!
touch
"
$DIR
/passwd/unknown-uid"
sudo
-u
"
$ROOT
"
chown
$INVALID_UID
"
$DIR
/passwd/unknown-uid"
touch
"
$DIR
/passwd/unknown-gid"
sudo
-u
"
$ROOT
"
chgrp
$INVALID_GID
"
$DIR
/passwd/unknown-gid"
## -- permissions --
mkdir
"
$DIR
/permissions"
touch
"
$DIR
/permissions/all-permissions"
chmod
777
"
$DIR
/permissions/all-permissions"
touch
"
$DIR
/permissions/no-permissions"
chmod
000
"
$DIR
/permissions/no-permissions"
mkdir
"
$DIR
/permissions/forbidden-directory"
chmod
000
"
$DIR
/permissions/forbidden-directory"
## -- extended attributes --
mkdir
"
$DIR
/attributes"
touch
"
$DIR
/attributes/none"
touch
"
$DIR
/attributes/one"
xattr
-w
greeting hello
"
$DIR
/attributes/one"
touch
"
$DIR
/attributes/two"
xattr
-w
greeting hello
"
$DIR
/attributes/two"
xattr
-w
another_greeting hi
"
$DIR
/attributes/two"
touch
"
$DIR
/attributes/forbidden"
xattr
-w
greeting hello
"
$DIR
/attributes/forbidden"
chmod
+a
"
$YOU
deny readextattr"
"
$DIR
/attributes/forbidden"
mkdir
"
$DIR
/attributes/dirs"
mkdir
"
$DIR
/attributes/dirs/empty-with-attribute"
xattr
-w
greeting hello
"
$DIR
/attributes/dirs/empty-with-attribute"
mkdir
"
$DIR
/attributes/dirs/full-with-attribute"
touch
"
$DIR
/attributes/dirs/full-with-attribute/file"
xattr
-w
greeting hello
"
$DIR
/attributes/dirs/full-with-attribute"
mkdir
"
$DIR
/attributes/dirs/full-but-forbidden"
touch
"
$DIR
/attributes/dirs/full-but-forbidden/file"
xattr
-w
greeting hello
"
$DIR
/attributes/dirs/full-but-forbidden"
chmod
000
"
$DIR
/attributes/dirs/full-but-forbidden"
chmod
+a
"
$YOU
deny readextattr"
"
$DIR
/attributes/dirs/full-but-forbidden"
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录