Update page '6-8-2023 Cohort 1 Sync Notes'

j
2023-06-09 00:35:03 +02:00
parent 2296005daa
commit 7e47662dc7
+47
@@ -0,0 +1,47 @@
1425h Started late
* Karen can't execute the python file in the `pricer` repository; attempting to do `./fp2_14.py` results in syntax errors
* Explained how the Linux execution model works
* Executable permission, octal permission bits, what octal is, world|group|user, not guaranteed on Windows
* 1) binfmt subsystem checks for valid *binary* formats at https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/exec.c?h=v6.3
* 2) if none of the registered binfmt handlers think it's one of theirs, then
* 3) fall back to #! processing (pronounced "sh-bang")
* 4) give it to /bin/sh
* 5) if `/bin/sh` can't figure out what's in the file, then the kernel won't execute it, and will return an error
* https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
* What shell means, tootsie roll pops, family tree: https://i.pinimg.com/736x/39/29/41/392941169141711c54c7de093f6c8938--software-libre-software-development.jpg
* What polyglot means
* Polyglot interpretation of the `#` character
* \#\!
* bourne shell reserved words; ` ! case coproc do done elif else esac fi for function if in select then until while { } time [[ ]]`
* `command not found` is a strong hint that the executing interpreter is some kind of command language, usually bourne shell
* `exec.c`
* `/usr/bin/env` is used to do path lookup on an executable in cases where the shell does not have a PATH, or other environment variables need to be specified
* Kernel does not enforce namespace policies, or filesystem layout policies
* Binary formats: ELF: unix/linux, Mach-O: macos, PE/COFF: windows
* default shell: bourne, decoupling of the `/bin/sh` *name* and the actual binary
* Best practices:
* begin every program with a shebang (`#!`)
* have a company standard for what to put after the shebang, whether to use /usr/bin/env or not
* make sure scripts have the executable permission when checked in to the source repository
Questions:
* What happens if you put random garbage into a file and try to execute it?
* What scripting languages do not use `#` as a comment character, and cannot use the `#!` mechanism to be directly executed
1525h Karen used the suggested troubleshooting procedure:
```
the troubleshooting process should be 1) I know I checked out the repository 2) running the file from the default current directory ('.' is the current directory) doesn't work 3) logically, I can conclude that the file is not in my default current directory, so 4) it's somewhere else 5) I can find where it is by using `find . -name git` as shown around 1450h in the notes yesterday https://gogs.gtsplab.com:5432/SVIG/python-bootcamp/wiki/6-7-2023+Cohort+1+Sync+Notes
```
She assumed that she didn't set up the python environment, then logged into the container and ran the program, got an error when using `python`, tried `python3` instead, and now the program executes.
Make sure that executable files do not touch any unfiltered data, especially from the Internet, because the bourne shell has zero security and falling back to it for execution is a security hazard.
Enrichment reading: shellshock https://en.wikipedia.org/wiki/Shellshock_(software_bug)
Karen points out that selenium does not require explicit installation, because it's included in `requirements.txt`
The next major hurdle will be getting `chromium-browser` to run headless. Search terms: X-windows, Weyland, Xvfb, framebuffer