Skip to content

First draft of check_everything.py -- checks directory owner/group/permissions#1030

Merged
bmcutler merged 14 commits intomasterfrom
check_owner_etc
Jun 8, 2017
Merged

First draft of check_everything.py -- checks directory owner/group/permissions#1030
bmcutler merged 14 commits intomasterfrom
check_owner_etc

Conversation

@bmcutler
Copy link
Member

@bmcutler bmcutler commented Jun 8, 2017

Will eventually be added to travis and expanded with more complete Submitty system checking

Closes #991

@bmcutler bmcutler requested a review from MasterOdin June 8, 2017 17:24
try:
pwd.getpwnam(my_owner)
except KeyError:
sys.stderr.write("ERROR! user "+my_owner+" does not exist\n")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

print("ERROR! user "+my_owner+" does not exist\n", file=sys.stderr) is probably the more "pythonic" way to do this.


global_success &= CheckItemBits(course_path+"/reports",True,c_instructor,c_group,0o770)
global_success &= CheckItemBits(course_path+"/reports/summary_html",True,c_instructor,c_group,0o770)
global_success &= CheckItemBits(course_path+"/reports/all_grades",True,"hwphp",c_group,0o770)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd almost want this to be a list of tuples that look like:

checks = [
    ("build", c_instructor, 0o770),
    ...
    ("submissions", "hwphp", 0o750),
    ...
]

for folder, user, mode in checks:
    global_success &= CheckItemBits(os.path.join(course_path, folder), True, user, c_group, mode)

which would make it a bit easier to add new checks/modify one, etc.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not going to do this suggestion now. Some of the checks are directories, some are files (true/false). And we may throw some loops in there to check the contents and subdirectories too. I expect this code will be restructured as it is expanded.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fair enough.

except KeyError:
sys.stderr.write("ERROR! group "+my_group+" does not exist\n")
ret_val = False
c_g = grp.getgrnam(my_group)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will throw a KeyError if my_group does not eixst.

I think it'd make sense to do:

cb_g = grp.getgrnam(COURSE_BUILDERS_GROUP)
try:
    c_g = grp.getgrname(my_group)
    try:
        pwd.getpwnam(my_instructor)
        if not my_instructor in c_g.gr_mem:
            ...
        if not my_instructor in cb_g.gr_mem:
            ...
    except KeyError:
        ...
    if not HWPHP_USER in c_g.gr_mem:
        ...
    if not HWCRON_USER in c_g.gr_mem:
        ...
except KeyError:
    ...

as no point doing the c_g checks if the group doesn't exist and same with the checks for instructor if it doesn't exist.

@MasterOdin
Copy link
Member

For travis, I think adding it to the after_script section is best for right now (unless it passes perfectly on Travis, at which point move it to script. It will output whatever from the script, but won't cause the Travis build to fail so that we can work towards getting the right permissions set, but not delaying adding this script for right now.

ret_val = False
if not os.path.exists(my_path):
print("ERROR! "+my_path+" does not exist\n", file=sys.stderr)
ret_val = False
Copy link
Member

@MasterOdin MasterOdin Jun 8, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't like the ordering of these checks and that they're all if statements (as if we enter one of them, can't see us entering any of the other ones.

if not os.path.exists(my_path):
    ...
elif is_dir and not os.path.isdir(my_path):
    ...
elif not is_dir and not os.path.isfile(my_path):
    ...

@bmcutler bmcutler merged commit 03ab4fb into master Jun 8, 2017
@bmcutler bmcutler deleted the check_owner_etc branch June 8, 2017 23:21
emaicus pushed a commit that referenced this pull request Jun 19, 2017
…rmissions (#1030)

* just starting

* progress

* a bit more

* edits to check_everything script

* more checks

* change requests

* rearrange logic

* add to travis after_script
bmcutler pushed a commit that referenced this pull request Jun 26, 2017
* Added directories to path in execute.cpp. Added gfx installs and cmake permissions in install_system.sh

* added php zip file fix

* Added very rough version of window_utils

* Added support for screenshotting. Separated window code into window_utils

Author:   Evan Maicus <emaicus@outlook.com>

* Added support for delays and typed commands

* Added detection of window name based on child pid

* Added click and drag support. Added mouse support.

* Added error checking and documentation

* Large overhaul of click and drag.

* Added comments, added alt button support in click and drag, tested in prep for pull request.

* Added support for decimal delays.

* add sorting options for labs, default viewing options for labs (#992)

* add sorting options for labs, default viewing options for labs

* sorting for registration and rotation grading

* sort by more than just id

* Progress on revising navigation page with submission status (#962)

progress on issue #674

* Allow user to specify whether they should stay logged in (past browser closure), defaults to true (#1014)

* Ambersands no longer get truncated (#1022)

* Gradeable layout with only numerics (#1023)

* Looks better when there are zero numeric fields

* Looks better when there are zero numeric fields

* Electronic grader, changes names of functions and default for if instructor has grading (#1026)

* add sorting options for labs, default viewing options for labs

* sorting for registration and rotation grading

* sort by more than just id

* changed function names

* now user id not left aligned

* remove unneeded code

* Creating a new Numeric Gradeable has a total points row (#1025)

* Added a row for total points.

* total row is functional

* is updated when you make a gradeable from a template

* made suggested changes and fixed a typo.

* all updates made

* corrected some unnecessary changes

* First draft of check_everything.py -- checks directory owner/group/permissions (#1030)

* just starting

* progress

* a bit more

* edits to check_everything script

* more checks

* change requests

* rearrange logic

* add to travis after_script

* Extra credit colors (#1024)

* Penalty, extra, and normal credit look diffirent now

* Extra credit and penalty have colors and icons

* The icons are now on the left

* Create Gradeable:  check for invalid dates and gradeable_ids (#1021)

* Added checks for the form for the user

* updated with requested changes

* updated with requested changes

* check for hwcron user at the top of grade_students.sh (#1044)

* Update sample apache configuration for Ubuntu 16.04 configuration (#1020)

* Improved checking of autograding execution of local and system programs (#1050)

replace 'assignment' with 'gradeable' in grade_students.sh (improves consistency)

better error message for attempted use of system programs that are not on the whitelist

now scrapes the config.json for names of compiled_executables to improve the check for local programs

if the config.json uses an unacceptable local, now it complains at BUILD time (not delaying to submission debugging as before)

fix autograding test failures

disabled seccomp because it's broken :( will make a new issue & fix that next, in a new PR #1051.

* remove PHP 5.5 (#1054)

* Added very rough version of window_utils

* Added support for screenshotting. Separated window code into window_utils

Author:   Evan Maicus <emaicus@outlook.com>

* Added support for delays and typed commands

* Added detection of window name based on child pid

* Added click and drag support. Added mouse support.

* Added error checking and documentation

* Large overhaul of click and drag.

* Added comments, added alt button support in click and drag, tested in prep for pull request.

* Added support for decimal delays.

* Refactored comments, fixed spelling issues.

* Fixed formatting, hacked seccomp

* Fixed mislabeled allowed system programs
bmcutler pushed a commit that referenced this pull request Jul 19, 2017
… in Electronic Gradeable Uploads (#1209)

* Added directories to path in execute.cpp. Added gfx installs and cmake permissions in install_system.sh

* added php zip file fix

* Added very rough version of window_utils

* Added support for screenshotting. Separated window code into window_utils

Author:   Evan Maicus <emaicus@outlook.com>

* Added support for delays and typed commands

* Added detection of window name based on child pid

* Added click and drag support. Added mouse support.

* Added error checking and documentation

* Large overhaul of click and drag.

* Added comments, added alt button support in click and drag, tested in prep for pull request.

* Added support for decimal delays.

* add sorting options for labs, default viewing options for labs (#992)

* add sorting options for labs, default viewing options for labs

* sorting for registration and rotation grading

* sort by more than just id

* Progress on revising navigation page with submission status (#962)

progress on issue #674

* Allow user to specify whether they should stay logged in (past browser closure), defaults to true (#1014)

* Ambersands no longer get truncated (#1022)

* Gradeable layout with only numerics (#1023)

* Looks better when there are zero numeric fields

* Looks better when there are zero numeric fields

* Electronic grader, changes names of functions and default for if instructor has grading (#1026)

* add sorting options for labs, default viewing options for labs

* sorting for registration and rotation grading

* sort by more than just id

* changed function names

* now user id not left aligned

* remove unneeded code

* Creating a new Numeric Gradeable has a total points row (#1025)

* Added a row for total points.

* total row is functional

* is updated when you make a gradeable from a template

* made suggested changes and fixed a typo.

* all updates made

* corrected some unnecessary changes

* First draft of check_everything.py -- checks directory owner/group/permissions (#1030)

* just starting

* progress

* a bit more

* edits to check_everything script

* more checks

* change requests

* rearrange logic

* add to travis after_script

* Extra credit colors (#1024)

* Penalty, extra, and normal credit look diffirent now

* Extra credit and penalty have colors and icons

* The icons are now on the left

* Create Gradeable:  check for invalid dates and gradeable_ids (#1021)

* Added checks for the form for the user

* updated with requested changes

* updated with requested changes

* check for hwcron user at the top of grade_students.sh (#1044)

* Update sample apache configuration for Ubuntu 16.04 configuration (#1020)

* Improved checking of autograding execution of local and system programs (#1050)

replace 'assignment' with 'gradeable' in grade_students.sh (improves consistency)

better error message for attempted use of system programs that are not on the whitelist

now scrapes the config.json for names of compiled_executables to improve the check for local programs

if the config.json uses an unacceptable local, now it complains at BUILD time (not delaying to submission debugging as before)

fix autograding test failures

disabled seccomp because it's broken :( will make a new issue & fix that next, in a new PR #1051.

* remove PHP 5.5 (#1054)

* Added very rough version of window_utils

* Added support for screenshotting. Separated window code into window_utils

Author:   Evan Maicus <emaicus@outlook.com>

* Added support for delays and typed commands

* Added detection of window name based on child pid

* Added click and drag support. Added mouse support.

* Added error checking and documentation

* Large overhaul of click and drag.

* Added comments, added alt button support in click and drag, tested in prep for pull request.

* Added support for decimal delays.

* Refactored comments, fixed spelling issues.

* Fixed formatting, hacked seccomp

* Fixed mislabeled allowed system programs

* Added support for image diff.

* added support to view expected image file.

* fixed a regex bug in windowutils, finalized image diff functionality.

* fixed a regex bug in windowutils, finalized image diff functionality.

* checkpoint

* Got text box images working

* finished textbox images. finished image diff. fixed ta grading page image issues. fixed ta grading page error display issues.

* added borders around images.

* Added support for image resizing for textboxes. Resolved local test errors.

* formatted.

* added blue info messages and per image resizing.

* Added new autograding examples for image diffing and textbox images.

* updated travis test.

* Quick fix.

* hotfix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants