Skip to content

Commit

Permalink
Merge 'dev' ~ 'v563' - buffer overflow fix + upgraded dev tooling
Browse files Browse the repository at this point in the history
  • Loading branch information
rivy committed Aug 27, 2022
2 parents cf2d7a1 + f753b3c commit a60805f
Show file tree
Hide file tree
Showing 11 changed files with 730 additions and 276 deletions.
51 changes: 45 additions & 6 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,25 +1,64 @@
# EditorConfig (is awesome): http://EditorConfig.org
# v2022.08.26; rivy

# * top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
# default ~ utf-8, unix-style newlines with a newline ending every file, 4 space indentation (and tab width)
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
max_line_length = 100
smart_tabs = unset # unstable; ref: <https://github.com/editorconfig/editorconfig/issues/323>
tab_width = unset # default to 'indent_size'
trim_trailing_whitespace = true

[{[Mm]akefile{,.*},*.{mak,mk,[Mm][Aa][Kk],[Mm][Kk]},[Gg][Nn][Uu]makefile}]
# makefiles ~ TAB-style indentation
indent_style = tab

[*.{bash,sh}]
# Linux/POSIX shell scripts
indent_size = 4
indent_style = space

[*.{bat,cmd,[Bb][Aa][Tt],[Cc][Mm][Dd]}]
# DOS/Win requires BAT/CMD files to have CRLF EOLNs
# BAT/CMD ~ DOS/Win requires BAT/CMD files to have CRLF EOLNs
end_of_line = crlf

[[Mm]akefile{,.*}]
# TAB-style indentation
[*.{c,cpp,cxx,h,hpp,hxx}]
indent_size = 2

[*.{cjs,cjx,cts,ctx,js,jsx,mjs,mts,mtx,ts,tsx,json,jsonc,vue}]
# js/ts/json ~ Prettier/XO-style == TAB indention + SPACE alignment
indent_size = 2
indent_style = tab
smart_tabs = true

[*.go]
# go ~ TAB-style indentation (SPACE-style alignment); ref: <https://blog.golang.org/gofmt>@@<https://archive.is/wip/9B6FC>
indent_style = tab
smart_tabs = true

[*.{yml,[Yy][Mm][Ll]}]
# DOS/Win requires BAT/CMD files to have CRLF EOLNs
[*.jq]
# `jq` script files
indent_size = 2
indent_style = space

[*.{markdown,md,mkd,[Mm][Dd],[Mm][Kk][Dd],[Mm][Dd][Oo][Ww][Nn],[Mm][Kk][Dd][Oo][Ww][Nn],[Mm][Aa][Rr][Kk][Dd][Oo][Ww][Nn]}]
# markdown
indent_size = 2
indent_style = space

[*.{sln,vc{,x}proj{,.*},[Ss][Ln][Nn],[Vv][Cc]{,[Xx]}[Pp][Rr][Oo][Jj]{,.*}}]
# MSVC sln/vcproj/vcxproj files, when used, will persistantly revert to CRLF EOLNs and eat final EOLs
end_of_line = crlf
insert_final_newline = false

[*.{yaml,yml,[Yy][Mm][Ll],[Yy][Aa][Mm][Ll]}]
# YAML
indent_size = 2
indent_style = space
16 changes: 8 additions & 8 deletions .github/workflows/CICD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ name: CICD

env:
PROJECT_NAME: less
PROJECT_DESC: "`less` is more"
PROJECT_EXES: "less lessecho lesskey" ## 'make ... all' binary executables
PROJECT_DESC: '`less` is more'
PROJECT_EXES: 'less lessecho lesskey' ## 'make ... all' binary executables

on: [push, pull_request]

Expand Down Expand Up @@ -141,7 +141,7 @@ jobs:
sudo apt-get -y install lib32ncurses5-dev libncurses5-dev gcc-multilib clang
;;
windows-*)
case '${{ matrix.job.compiler }}' in clang) echo "::add-path::C:/Program Files/LLVM/bin" ;; esac;
case '${{ matrix.job.compiler }}' in clang) echo "C:/Program Files/LLVM/bin" >> $GITHUB_PATH ;; esac;
;;
esac
case '${{ matrix.job.compiler }}' in
Expand All @@ -152,9 +152,9 @@ jobs:
clang) CC=clang ; CXX=clang++ ; LD=${CXX} ;;
gcc) CC=gcc ; CXX=g++ ; LD=${CXX} ;;
esac
echo "::set-env name=CC::${CC}"
echo "::set-env name=CXX::${CXX}"
echo "::set-env name=LD::${LD}"
echo "CC=${CC}" >> $GITHUB_ENV
echo "CXX=${CXX}" >> $GITHUB_ENV
echo "LD=${LD}" >> $GITHUB_ENV
- name: Info
shell: bash
run: |
Expand Down Expand Up @@ -185,10 +185,10 @@ jobs:
./configure CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}"
;;
windows-*)
cp Makefile.win Makefile
MAKE_overrides="OUT_DIR_bin=." ## force binaries to '.' (which is the default for *nix), instead of OOS
;;
esac
make CC="${CC}" CXX="${CXX}" LD="${LD}" ARCH='${{ steps.vars.outputs.ARCH_ID }}' STATIC='${{ matrix.job.static }}' all
make all CC="${CC}" CXX="${CXX}" LD="${LD}" ARCH='${{ steps.vars.outputs.ARCH_ID }}' STATIC='${{ matrix.job.static }}' ${MAKE_overrides}
for exe in ${PROJECT_EXES} ; do
cp "${exe}${{ steps.vars.outputs.EXE_suffix }}" '${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.PKG_stem }}/bin/'
done
Expand Down
49 changes: 37 additions & 12 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,21 +1,46 @@
# NOTE: GLOBSTAR syntax [see `git help gitignore`]
# v2022-08-26+less-mods [rivy]

# ignore generated object files
*.o
*.obj
# NOTE: Git GLOBSTAR syntax [see `git help gitignore`]
# * ref: [.gitignore] http://git-scm.com/docs/gitignore @@ http://archive.is/Rk6rO
# * ref: [Generate gitignore's](https://gitignore.io) ; eg, <https://gitignore.io/api/node>

# ignore generated headers
defines.h
# ignore intermediate/undistributed build artifacts
build
[._@#$]build
target

# ignore coverage data
coverage
[._@#$]coverage
.nyc_output

# ignore JS import/package-related files
node_modules
package-lock.json
yarn.lock

# ignore localized VSCode logs/settings
.vscode/c_cpp_properties.json
.vscode/makefile.extension.output
# * ignore VSCode precompiled headers for IntelliSense
.vscode/ipch/

# ignore generated executables
## local additions ##

# `less` ~ most older Makefiles still generate artifacts *within* the source code folder

# ignore generated artifacts
# * executables
less
less.exe
lessecho
lessecho.exe
lesskey
lesskey.exe

# ignore localized VSCode settings
.vscode/c_cpp_properties.json
# ignore VSCode precompiled headers for IntelliSense
.vscode/ipch/
# * depfiles
*.d
# * headers
defines.h
# * object files
*.o
*.obj
76 changes: 57 additions & 19 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,59 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Debug `less`",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/less.exe",
// "args": [ "../causes-fault-single-line.txt" ],
"stopAtEntry": true,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"logging": { "engineLogging": true },
"MIMode": "gdb",
"miDebuggerPath": "gdb.exe",
"setupCommands": [ { "text": "-enable-pretty-printing", "description": "Enable GDB pretty printing", "ignoreFailures": true } ],
"preLaunchTask": "${defaultBuildTask}",
}
]
// ref: [MSVSC ~ 'launch' configurations](https://go.microsoft.com/fwlink/?linkid=830387)
// note: use IntelliSense to learn about possible attributes; hover to view descriptions of existing attributes.
"version": "0.2.0",
"configurations": [
{
"name": "Debug (32-bit)",
"type": "cppdbg",
"request": "launch",
"program": "${fileWorkspaceFolder}/${config:project.build_dir}/debug.(vscode)-x32/bin/${config:project.name}.exe",
"args": [], // * note: use this configuration array to add run-time arguments to the debugged process
// "args": ["/?"], // * note: use this configuration array to add run-time arguments to the debugged process
// "args": ["${fileWorkspaceFolder}/../causes-fault-single-line.txt"],
"stopAtEntry": false,
"cwd": "${fileWorkspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "gdb.exe",
"setupCommands": [
{
"description": "Enable GDB pretty-printing",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Fix pretty-printing of UTF-8 characters; ref: <https://stackoverflow.com/a/68954359/43774>",
"text": "set charset UTF-8"
}
],
"preLaunchTask": "Build (gcc/32-bit/DEBUG)"
},
{
"name": "Debug (64-bit)",
"type": "cppdbg",
"request": "launch",
"program": "${fileWorkspaceFolder}/${config:project.build_dir}/debug.(vscode)-x64/bin/${config:project.name}.exe",
"args": [], // * note: use this configuration array to add run-time arguments to the debugged process
"stopAtEntry": false,
"cwd": "${fileWorkspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "gdb.exe",
"setupCommands": [
{
"description": "Enable pretty-printing",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Fix pretty-printing of UTF-8 characters; ref: <https://stackoverflow.com/a/68954359/43774>",
"text": "set charset UTF-8"
}
],
"preLaunchTask": "Build (gcc/64-bit/DEBUG)"
}
]
}
12 changes: 1 addition & 11 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,11 +1 @@
{
"cSpell.words": [
"Nudelman",
"dir",
"klietz",
"msls",
"ntfs",
"repo"
],
"C_Cpp.intelliSenseEngineFallback": "Disabled"
}
{ "project": { "name": "project", "build_dir": "#build", "make_options": "" } }
121 changes: 39 additions & 82 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,84 +1,41 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Build (clang; debug)",
"type": "shell",
"command": "make",
"args": [
"-f",
"Makefile.win",
"CC=clang",
"DEBUG=1"
],
"group": "build",
"problemMatcher": [
"$gcc"
]
},
{
"label": "Build (gcc; debug)",
"type": "shell",
"command": "make",
"args": [
"-f",
"Makefile.win",
"CC=gcc",
"DEBUG=1"
],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [
"$gcc"
]
},
{
"label": "Clean",
"type": "shell",
"command": "make",
"args": [
"-f",
"Makefile.win",
"clean"
],
"group": "none",
"problemMatcher": [
"$gcc"
]
},
{
"label": "REBuild (clang; debug)",
"type": "shell",
"command": "make",
"args": [
"rebuild",
"-f",
"Makefile.win",
"CC=clang",
"DEBUG=1"
],
"group": "build",
"problemMatcher": [
"$gcc"
]
},
{
"label": "REBuild (gcc; debug)",
"type": "shell",
"command": "make",
"args": [
"rebuild",
"-f",
"Makefile.win",
"CC=gcc",
"DEBUG=1"
],
"group": "build",
"problemMatcher": [
"$gcc"
]
},
]
// ref: [MSVSC ~ 'tasks.json' docs](https://go.microsoft.com/fwlink/?LinkId=733558)
// note: use IntelliSense to learn about possible attributes; hover to view descriptions of existing attributes.
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "Build (gcc/32-bit/DEBUG)",
"command": "make CC=gcc DEBUG=1 ARCH=32 OUT_DIR=${config:project.build_dir}/debug.(vscode)-x32 NAME=${config:project.name} EXEEXT=.exe ${config:project.make_options}",
"options": { "cwd": "${fileWorkspaceFolder}" },
"problemMatcher": ["$gcc"],
"group": { "kind": "build", "isDefault": true }
},
{
"type": "shell",
"label": "Build (gcc/64-bit/DEBUG)",
"command": "make CC=gcc DEBUG=1 ARCH=64 OUT_DIR=${config:project.build_dir}/debug.(vscode)-x64 NAME=${config:project.name} EXEEXT=.exe ${config:project.make_options}",
"options": { "cwd": "${fileWorkspaceFolder}" },
"problemMatcher": ["$gcc"],
"group": { "kind": "build", "isDefault": true }
},
{ "type": "shell", "label": "Clean (realclean) project", "command": "make realclean" },
{
"type": "shell",
"label": "REbuild (gcc/32-bit/DEBUG)",
"command": "make rebuild CC=gcc DEBUG=1 ARCH=32 OUT_DIR=${config:project.build_dir}/debug.(vscode)-x32 NAME=${config:project.name} EXEEXT=.exe ${config:project.make_options}",
"options": { "cwd": "${fileWorkspaceFolder}" },
"problemMatcher": ["$gcc"],
"group": { "kind": "build", "isDefault": true }
},
{
"type": "shell",
"label": "REbuild (gcc/64-bit/DEBUG)",
"command": "make rebuild CC=gcc DEBUG=1 ARCH=64 OUT_DIR=${config:project.build_dir}/debug.(vscode)-x64 NAME=${config:project.name} EXEEXT=.exe ${config:project.make_options}",
"options": { "cwd": "${fileWorkspaceFolder}" },
"problemMatcher": ["$gcc"],
"group": { "kind": "build", "isDefault": true }
}
// { "type": "shell", "label": "DEBUG echo", "command": "echo ${fileWorkspaceFolder}" }
]
}
Loading

0 comments on commit a60805f

Please sign in to comment.