Skip to content

Commit 9b78000

Browse files
committed
Revert "fileinfo: Obey POSIX in pattern conversion"
This reverts commit 343d1c2. Also remove the incompatible test data for time being. The new line handling will need an extra fix. Signed-off-by: Anatol Belski <[email protected]>
1 parent 343d1c2 commit 9b78000

File tree

4 files changed

+0
-47
lines changed

4 files changed

+0
-47
lines changed

ext/fileinfo/libmagic/softmagic.c

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2025,7 +2025,6 @@ public zend_string* convert_libmagic_pattern(const char *val, size_t len, uint32
20252025
j = 0;
20262026
ZSTR_VAL(t)[j++] = '~';
20272027

2028-
bool add_newline = false;
20292028
for (i = 0; i < len; i++, j++) {
20302029
switch (val[i]) {
20312030
case '~':
@@ -2038,21 +2037,6 @@ public zend_string* convert_libmagic_pattern(const char *val, size_t len, uint32
20382037
ZSTR_VAL(t)[j++] = '0';
20392038
ZSTR_VAL(t)[j] = '0';
20402039
break;
2041-
/* If POSIX regex class negates, make sure possible '\n' is taken into
2042-
account. For example "[^;]" is converted to "[^;]\n?" to obey POSIX. */
2043-
case '^':
2044-
ZSTR_VAL(t)[j] = val[i];
2045-
add_newline = (j >= 1 && '[' == ZSTR_VAL(t)[j-1]);
2046-
break;
2047-
case ']':
2048-
ZSTR_VAL(t)[j] = val[i];
2049-
if (add_newline) {
2050-
t = zend_string_realloc(t, ZSTR_LEN(t) + 3, GC_TYPE_INFO(t) & IS_STR_PERSISTENT);
2051-
ZSTR_VAL(t)[j++] = '\\';
2052-
ZSTR_VAL(t)[j++] = 'n';
2053-
ZSTR_VAL(t)[j++] = '?';
2054-
add_newline = false;
2055-
}
20562040
default:
20572041
ZSTR_VAL(t)[j] = val[i];
20582042
break;

ext/fileinfo/tests/upstream/regex-eol.magic

Lines changed: 0 additions & 6 deletions
This file was deleted.

ext/fileinfo/tests/upstream/regex-eol.result

Lines changed: 0 additions & 1 deletion
This file was deleted.

ext/fileinfo/tests/upstream/regex-eol.testfile

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)