Skip to content

Commit 82bc99c

Browse files
zhan7236tuhaihe
authored andcommitted
Fix gawk regexp escape sequence warning
Fix issue #1206: Replace [^\#] with [^\043] in AWK regex patterns. The original [^\#] caused a gawk warning: 'regexp escape sequence `#' is not a known regexp operator' The initial fix of changing to [^#] broke the build because Make interprets # as a comment character, truncating the command. This fix uses the octal escape sequence \043 (ASCII code for #) which: 1. Is properly escaped for Make (not interpreted as comment) 2. Is a valid AWK/regex escape sequence (no warning) 3. Works with both gawk and mawk Changes: - src/Makefile.shlib: 5 occurrences updated - src/backend/Makefile: 2 occurrences updated
1 parent ce9d91f commit 82bc99c

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/Makefile.shlib

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ ifeq ($(PORTNAME), darwin)
130130
DLSUFFIX = .so
131131
LINK.shared = $(COMPILER) -bundle -multiply_defined suppress
132132
endif
133-
BUILD.exports = $(AWK) '/^[^\#]/ {printf "_%s\n",$$1}' $< >$@
133+
BUILD.exports = $(AWK) '/^[^\043]/ {printf "_%s\n",$$1}' $< >$@
134134
exports_file = $(SHLIB_EXPORTS:%.txt=%.list)
135135
ifneq (,$(exports_file))
136136
exported_symbols_list = -exported_symbols_list $(exports_file)
@@ -142,7 +142,7 @@ ifeq ($(PORTNAME), openbsd)
142142
ifdef soname
143143
LINK.shared += -Wl,-x,-soname,$(soname)
144144
endif
145-
BUILD.exports = ( echo '{ global:'; $(AWK) '/^[^\#]/ {printf "%s;\n",$$1}' $<; echo ' local: *; };' ) >$@
145+
BUILD.exports = ( echo '{ global:'; $(AWK) '/^[^\043]/ {printf "%s;\n",$$1}' $<; echo ' local: *; };' ) >$@
146146
exports_file = $(SHLIB_EXPORTS:%.txt=%.list)
147147
ifneq (,$(exports_file))
148148
LINK.shared += -Wl,--version-script=$(exports_file)
@@ -158,7 +158,7 @@ ifeq ($(PORTNAME), freebsd)
158158
ifdef soname
159159
LINK.shared += -Wl,-x,-soname,$(soname)
160160
endif
161-
BUILD.exports = ( echo '{ global:'; $(AWK) '/^[^\#]/ {printf "%s;\n",$$1}' $<; echo ' local: *; };' ) >$@
161+
BUILD.exports = ( echo '{ global:'; $(AWK) '/^[^\043]/ {printf "%s;\n",$$1}' $<; echo ' local: *; };' ) >$@
162162
exports_file = $(SHLIB_EXPORTS:%.txt=%.list)
163163
ifneq (,$(exports_file))
164164
LINK.shared += -Wl,--version-script=$(exports_file)
@@ -170,7 +170,7 @@ ifeq ($(PORTNAME), netbsd)
170170
ifdef soname
171171
LINK.shared += -Wl,-x,-soname,$(soname)
172172
endif
173-
BUILD.exports = ( echo '{ global:'; $(AWK) '/^[^\#]/ {printf "%s;\n",$$1}' $<; echo ' local: *; };' ) >$@
173+
BUILD.exports = ( echo '{ global:'; $(AWK) '/^[^\043]/ {printf "%s;\n",$$1}' $<; echo ' local: *; };' ) >$@
174174
exports_file = $(SHLIB_EXPORTS:%.txt=%.list)
175175
ifneq (,$(exports_file))
176176
LINK.shared += -Wl,--version-script=$(exports_file)
@@ -215,7 +215,7 @@ ifeq ($(PORTNAME), linux)
215215
ifdef soname
216216
LINK.shared += -Wl,-soname,$(soname)
217217
endif
218-
BUILD.exports = ( echo '{ global:'; $(AWK) '/^[^\#]/ {printf "%s;\n",$$1}' $<; echo ' local: *; };' ) >$@
218+
BUILD.exports = ( echo '{ global:'; $(AWK) '/^[^\043]/ {printf "%s;\n",$$1}' $<; echo ' local: *; };' ) >$@
219219
exports_file = $(SHLIB_EXPORTS:%.txt=%.list)
220220
ifneq (,$(exports_file))
221221
LINK.shared += -Wl,--version-script=$(exports_file)

src/backend/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,14 @@ SYMBOL_MAPPING_FLAGS =
9595
ifeq ($(PORTNAME), darwin)
9696
SYMBOL_MAP_FILE = hide_symbols.list
9797
$(SYMBOL_MAP_FILE): $(top_builddir)/src/interfaces/libpq/exports.txt
98-
$(AWK) '/^[^\#]/ {printf "_%s\n",$$1}' $< | grep -v -E $(SAFELY_EXPORTED_SYMBOLS_PATTERN) >$@
98+
$(AWK) '/^[^\043]/ {printf "_%s\n",$$1}' $< | grep -v -E $(SAFELY_EXPORTED_SYMBOLS_PATTERN) >$@
9999
SYMBOL_MAPPING_FLAGS = -unexported_symbols_list $(SYMBOL_MAP_FILE)
100100
endif
101101

102102
ifeq ($(PORTNAME), linux)
103103
SYMBOL_MAP_FILE = postgres_symbols.map
104104
$(SYMBOL_MAP_FILE): $(top_builddir)/src/interfaces/libpq/exports.txt
105-
( echo '{ global: *; '; echo ' local:'; $(AWK) '/^[^\#]/ {printf "%s;\n",$$1}' $< | grep -v -E $(SAFELY_EXPORTED_SYMBOLS_PATTERN); echo '};' ) >$@
105+
( echo '{ global: *; '; echo ' local:'; $(AWK) '/^[^\043]/ {printf "%s;\n",$$1}' $< | grep -v -E $(SAFELY_EXPORTED_SYMBOLS_PATTERN); echo '};' ) >$@
106106
SYMBOL_MAPPING_FLAGS = -Wl,--version-script=$(SYMBOL_MAP_FILE)
107107
endif
108108
ifeq ($(enable_shared_postgres_backend),yes)

0 commit comments

Comments
 (0)