chubin / chubin/cheat.sh

Internal Server Error 500 (re-issue)

Open
#423 62 comments 1 reaction 0 assignees View on GitHub
Dominant language
Python
Stars
41.7k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

Original Issue: **#422**

I didn't have permissions to re-open it so I had to make a new issue.

Glanced into the build logs and see:
Image

Job Run Snippet Lines 615-758

[job log](https://github.com/chubin/cheat.sh/actions/runs/16822510617/job/47652136704#step:615:758)

```
Running 8: :cht.sh
/usr/bin/python3 ../lib/standalone.py :cht.sh
--- results/8^I2025-08-08 05:15:15.525999978 +0000
+++ /tmp/cht.sh.tests-M1VjSQvCA3yaiF^I2025-08-08 05:16:41.971926720 +0000
@@ -114,7 +114,7 @@
cht.sh --mode lite # use https://cheat.sh/ only
cht.sh --mode auto # use local installation

-For intallation and standalone usage, you need \`git\`, \`python\`,
+For installation and standalone usage, you need \`git\`, \`python\`,
and \`virtualenv\` to be installed locally.
EOF
return
@@ -559,7 +559,7 @@
}

cmd_copy() {
- if [ -z "$DISPLAY" ]; then
+ if [ -z "$DISPLAY" ] && [ "$is_macos" != yes ]; then
echo copy: supported only in the Desktop version
elif [ -z "$input" ]; then
echo copy: Make at least one query first.
@@ -579,7 +579,7 @@
}

cmd_ccopy() {
- if [ -z "$DISPLAY" ]; then
+ if [ -z "$DISPLAY" ] && [ "$is_macos" != yes ]; then
echo copy: supported only in the Desktop version
elif [ -z "$input" ]; then
echo copy: Make at least one query first.
@@ -731,7 +731,7 @@
curl -s "${CHTSH_URL}"/:cht.sh > "$TMP2"
if ! cmp "$0" "$TMP2" > /dev/null 2>&1; then
if grep -q ^__CHTSH_VERSION= "$TMP2"; then
- # section was vaildated by us already
+ # section was validated by us already
args=(--shell "$section")
cp "$TMP2" "$0" && echo "Updated. Restarting..." && rm "$TMP2" && CHEATSH_RESTART=1 exec "$0" "${args[@]}"
else
FAILED: [8] :cht.sh
Running 9: cht.sh python copy file # [online]
/usr/bin/python3 ../lib/standalone.py python copy file
--- results/9^I2025-08-08 05:15:15.527000037 +0000
+++ /tmp/cht.sh.tests-M1VjSQvCA3yaiF^I2025-08-08 05:16:42.916926284 +0000
@@ -1,16 +1,23 @@
-^[[38;5;246;03m# How do I copy a file in Python?^[[39;00m
-^[[38;5;246;03m# ^[[39;00m
-^[[38;5;246;03m# shutil (http://docs.python.org/3/library/shutil.html) has many methods^[[39;00m
-^[[38;5;246;03m# you can use. One of which is:^[[39;00m
-
-^[[38;5;70;01mfrom^[[39;00m^[[38;5;252m ^[[39m^[[38;5;68;04mshutil^[[39;00m^[[38;5;252m ^[[39m^[[38;5;70;01mimport^[[39;00m^[[38;5;252m ^[[39m^[[38;5;252mcopyfile^[[39m
-
-^[[38;5;252mcopyfile^[[39m^[[38;5;252m(^[[39m^[[38;5;252msrc^[[39m^[[38;5;252m,^[[39m^[[38;5;252m ^[[39m^[[38;5;252mdst^[[39m^[[38;5;252m)^[[39m
-
-^[[38;5;246;03m# Copy the contents of the file named src to a file named dst. The^[[39;00m
-^[[38;5;246;03m# destination location must be writable; otherwise, an IOError exception^[[39;00m
-^[[38;5;246;03m# will be raised. If dst already exists, it will be replaced. Special^[[39;00m
-^[[38;5;246;03m# files such as character or block devices and pipes cannot be copied^[[39;00m
-^[[38;5;246;03m# with this function. src and dst are path names given as strings.^[[39;00m
-^[[38;5;246;03m# ^[[39;00m
-^[[38;5;246;03m# [Swati] [so/q/123198] [cc by-sa 3.0]^[[39;00m
+^[[38;5;248;03m# [`shutil`][1] has many methods you can use. One of which is:^[[39;00m
+^[[38;5;248;03m# ^[[39;00m
+^[[38;5;248;03m# ```^[[39;00m
+^[[38;5;248;03m# from shutil import copyfile^[[39;00m
+^[[38;5;248;03m# copyfile(src, dst)^[[39;00m
+^[[38;5;248;03m# ```^[[39;00m
+^[[38;5;248;03m# ^[[39;00m
+^[[38;5;252m ^[[39m^[[38;5;248;03m# - Copy the contents of the file named **src** to a file named^[[39;00m
+^[[38;5;248;03m# **dst**.^[[39;00m
+^[[38;5;252m ^[[39m^[[38;5;248;03m# - The destination location must be writable; otherwise, an^[[39;00m
+^[[38;5;248;03m# **IOError** exception will be raised.^[[39;00m
+^[[38;5;252m ^[[39m^[[38;5;248;03m# - If **dst** already exists, it will be replaced.^[[39;00m
+^[[38;5;252m ^[[39m^[[38;5;248;03m# - Special files such as character or block devices and pipes cannot^[[39;00m
+^[[38;5;248;03m# be copied with this function.^[[39;00m
+^[[38;5;252m ^[[39m^[[38;5;248;03m# - With **copy**, **src** and **dst** are path names given as^[[39;00m
+^[[38;5;248;03m# __strings__.^[[39;00m
+^[[38;5;248;03m# ^[[39;00m
+^[[38;5;248;03m# If you use `os.path` operations, use `copy` rather than `copyfile`.^[[39;00m
+^[[38;5;248;03m# `copyfile` will only accept strings.^[[39;00m
+^[[38;5;248;03m# ^[[39;00m
+^[[38;5;252m ^[[39m^[[38;5;248;03m# [1]: [http://docs.python.org/3/library/shutil.html^[[39;00m](http://docs.python.org/3/library/shutil.html%5E[[39;00m)
+^[[38;5;248;03m# ^[[39;00m
+^[[38;5;248;03m# [Swati] [so/q/123198] [cc by-sa 3.0]^[[39;00m
FAILED: [9] python copy file
Running 10: python/copy+file # [online]
/usr/bin/python3 ../lib/standalone.py python/copy+file
--- results/10^I2025-08-08 05:15:15.524999919 +0000
+++ /tmp/cht.sh.tests-M1VjSQvCA3yaiF^I2025-08-08 05:16:43.696925653 +0000
@@ -1,16 +1,23 @@
-^[[38;5;246;03m# How do I copy a file in Python?^[[39;00m
-^[[38;5;246;03m# ^[[39;00m
-^[[38;5;246;03m# shutil (http://docs.python.org/3/library/shutil.html) has many methods^[[39;00m
-^[[38;5;246;03m# you can use. One of which is:^[[39;00m
-
-^[[38;5;70;01mfrom^[[39;00m^[[38;5;252m ^[[39m^[[38;5;68;04mshutil^[[39;00m^[[38;5;252m ^[[39m^[[38;5;70;01mimport^[[39;00m^[[38;5;252m ^[[39m^[[38;5;252mcopyfile^[[39m
-
-^[[38;5;252mcopyfile^[[39m^[[38;5;252m(^[[39m^[[38;5;252msrc^[[39m^[[38;5;252m,^[[39m^[[38;5;252m ^[[39m^[[38;5;252mdst^[[39m^[[38;5;252m)^[[39m
-
-^[[38;5;246;03m# Copy the contents of the file named src to a file named dst. The^[[39;00m
-^[[38;5;246;03m# destination location must be writable; otherwise, an IOError exception^[[39;00m
-^[[38;5;246;03m# will be raised. If dst already exists, it will be replaced. Special^[[39;00m
-^[[38;5;246;03m# files such as character or block devices and pipes cannot be copied^[[39;00m
-^[[38;5;246;03m# with this function. src and dst are path names given as strings.^[[39;00m
-^[[38;5;246;03m# ^[[39;00m
-^[[38;5;246;03m# [Swati] [so/q/123198] [cc by-sa 3.0]^[[39;00m
+^[[38;5;248;03m# [`shutil`][1] has many methods you can use. One of which is:^[[39;00m
+^[[38;5;248;03m# ^[[39;00m
+^[[38;5;248;03m# ```^[[39;00m
+^[[38;5;248;03m# from shutil import copyfile^[[39;00m
+^[[38;5;248;03m# copyfile(src, dst)^[[39;00m
+^[[38;5;248;03m# ```^[[39;00m
+^[[38;5;248;03m# ^[[39;00m
+^[[38;5;252m ^[[39m^[[38;5;248;03m# - Copy the contents of the file named **src** to a file named^[[39;00m
+^[[38;5;248;03m# **dst**.^[[39;00m
+^[[38;5;252m ^[[39m^[[38;5;248;03m# - The destination location must be writable; otherwise, an^[[39;00m
+^[[38;5;248;03m# **IOError** exception will be raised.^[[39;00m
+^[[38;5;252m ^[[39m^[[38;5;248;03m# - If **dst** already exists, it will be replaced.^[[39;00m
+^[[38;5;252m ^[[39m^[[38;5;248;03m# - Special files such as character or block devices and pipes cannot^[[39;00m
+^[[38;5;248;03m# be copied with this function.^[[39;00m
+^[[38;5;252m ^[[39m^[[38;5;248;03m# - With **copy**, **src** and **dst** are path names given as^[[39;00m
+^[[38;5;248;03m# __strings__.^[[39;00m
+^[[38;5;248;03m# ^[[39;00m
+^[[38;5;248;03m# If you use `os.path` operations, use `copy` rather than `copyfile`.^[[39;00m
+^[[38;5;248;03m# `copyfile` will only accept strings.^[[39;00m
+^[[38;5;248;03m# ^[[39;00m
+^[[38;5;252m ^[[39m^[[38;5;248;03m# [1]: [http://docs.python.org/3/library/shutil.html^[[39;00m](http://docs.python.org/3/library/shutil.html%5E[[39;00m)
+^[[38;5;248;03m# ^[[39;00m
+^[[38;5;248;03m# [Swati] [so/q/123198] [cc by-sa 3.0]^[[39;00m
FAILED: [10] python/copy+file
Running 11: python/copy+file?Q # [online]
/usr/bin/python3 ../lib/standalone.py python/copy+file?Q
--- results/11^I2025-08-08 05:15:15.524999919 +0000
+++ /tmp/cht.sh.tests-M1VjSQvCA3yaiF^I2025-08-08 05:16:44.458925349 +0000
@@ -1,3 +1 @@
-^[[38;5;70;01mfrom^[[39;00m^[[38;5;252m ^[[39m^[[38;5;68;04mshutil^[[39;00m^[[38;5;252m ^[[39m^[[38;5;70;01mimport^[[39;00m^[[38;5;252m ^[[39m^[[38;5;252mcopyfile^[[39m

-^[[38;5;252mcopyfile^[[39m^[[38;5;252m(^[[39m^[[38;5;252msrc^[[39m^[[38;5;252m,^[[39m^[[38;5;252m ^[[39m^[[38;5;252mdst^[[39m^[[38;5;252m)^[[39m
FAILED: [11] python/copy+file?Q
Running 1
```

Contributor guide

Open the contributing guide

Research direction

Start with the linked build log and inspect lib/standalone.py together with the generated cht.sh output. Re-run the failing standalone commands for :cht.sh, python copy file, python/copy+file, and python/copy+file?Q. Done means the reported CI cases no longer produce the shown diffs or failures.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, shell
Domain
cli, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.