Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix extract-turnin permissions #53

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 29 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ name: turnin test suite
on:
push:
paths:
- 'src/**'
- 'Makefile'
- '.github/workflows/main.yml'
- "src/**"
- "scripts/**"
- "Makefile"
- ".github/workflows/main.yml"
pull_request:
paths:
- 'src/**'
- 'Makefile'
- '.github/workflows/main.yml'
- "src/**"
- "scripts/**"
- "Makefile"
- ".github/workflows/main.yml"

env:
COURSE: hy999
Expand All @@ -27,7 +29,8 @@ jobs:
sudo useradd -m $COURSE
grep $COURSE /etc/passwd
- name: Create TURNIN directory for new user
run: sudo -u $COURSE mkdir -p /home/$COURSE/TURNIN/ex1
run: |
sudo -u $COURSE mkdir -p /home/$COURSE/TURNIN/{ex1,ex2}
- name: Turn something in
run: |
whoami
Expand All @@ -36,4 +39,22 @@ jobs:
run: |
verify-turnin ex1@$COURSE
sudo -u $COURSE find /home/$COURSE/TURNIN/ex1/
sudo -u $COURSE find /home/$COURSE/TURNIN/ex1/ | grep `whoami` > /dev/null
sudo -u $COURSE find /home/$COURSE/TURNIN/ex1/ | grep `whoami` > /dev/null
- name: Verify turn in without submission
run: |
verify-turnin ex2@$COURSE || test $? -ne 0
- name: Verify turn in in non existing directory
run: |
verify-turnin ex3@$COURSE || test $? -ne 0
- name: Verify turn in in non existing course
run: |
verify-turnin ex1@mycourse || test $? -ne 0
- name: Verify extract turn in permissions
run: |
set -x
cp scripts/extract-turnins /home/$COURSE/TURNIN/ex1
cd /home/$COURSE/TURNIN/ex1
sudo -u $COURSE ./extract-turnins
FILE_PERMS=$(sudo -u $COURSE stat -L -c "%a %G %U" /home/$COURSE/TURNIN/ex1/runner/src/turnin.c) #| sudo -u $COURSE grep -o "600")
echo "$FILE_PERMS"
[ "$FILE_PERMS" -eq 600 ] || test $? -eq 0
1 change: 1 addition & 0 deletions scripts/extract-turnins
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ else
suffix=''
fi

umask 077
# Extract them
for i in *.tgz
do
Expand Down
2 changes: 1 addition & 1 deletion scripts/verify-turnin.sed.me
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def main():
" for " + course + " but it is not valid.")
else:
print(" You have not turned in " + assignment + " for " + course + "! ")
sys.exit(0)
sys.exit(1)

print(" You have successfully turned in " + assignment + " for " + course + " ")

Expand Down