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

[sfntedit] Fix bug when attempting to add non-existent file #1696

Merged
merged 4 commits into from
Sep 30, 2023
Merged
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ cov*.xml

# temp output dirs created during tests
**/temp_output

# macOS cruft
.DS_Store
2 changes: 1 addition & 1 deletion c/sfntedit/source/Efile.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ int fileExists(const char *filename) {
void fileOpenRead(const char *filename, File *fyl) {
{
fyl->fp = sysOpenSearchpath(filename);
fyl->name = filename;
if (fyl->fp == NULL)
fileError(fyl);
fyl->name = filename;
}
}

Expand Down
2 changes: 1 addition & 1 deletion c/sfntedit/source/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jmp_buf mark;

#endif /* SUNOS */

#define VERSION "1.4.3"
#define VERSION "1.4.4"

/* Data type sizes (bytes) */
#define uint16_ 2
Expand Down
10 changes: 10 additions & 0 deletions tests/sfntedit_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,13 @@ def test_missing_table_extract_bug160():
assert b'[WARNING]: table missing (xyz )' in output
expected_path = get_expected_path('head_light.tb')
assert differ([expected_path, actual_path, '-m', 'bin'])


def test_missing_file_add_bug_1658():
font_path = get_input_path(ITALIC)
actual_path = get_temp_file_path()
stderr_path = runner(CMD + ['-s', '-e', '-o', 'a', '_GDEF=non_existing_GDEF_file', # noqa: E501
'-f', font_path, actual_path])
with open(stderr_path, 'rb') as f:
output = f.read()
assert b'[FATAL]: file error <No such file or directory> [non_existing_GDEF_file]' in output # noqa: E501
Loading