[9.3 bug fix] ECPG does not escape backslashes

Поиск
Список
Период
Сортировка
От MauMau
Тема [9.3 bug fix] ECPG does not escape backslashes
Дата
Msg-id A0C361567285450883C37D254F58F054@maumau
обсуждение исходный текст
Ответы Re: [9.3 bug fix] ECPG does not escape backslashes  (Michael Meskes <meskes@postgresql.org>)
Re: [9.3 bug fix] ECPG does not escape backslashes  (Michael Meskes <meskes@postgresql.org>)
Список pgsql-hackers
Hello,

I happened to find a trivial bug of ECPG while experimenting with 9.3 beta
2.  Please find attached the patch to fix this.  This is not specific to
9.3.  Could you commit and backport this?


[Bug description]
Running "ecpg c:\command\a.pgc" produces the following line in a.c:

#line 1 "c:\command\a.pgc"

Then, compiling the resulting a.c with Visual Studio (cl.exe) issues the
warning:

a.c(8) : warning C4129: 'c' : unrecognized character escape sequence

This is because ecpg doesn't escape \ in the #line string.


[How to fix]
Escape \ in the input file name like this:

#line 1 "c:\\command\\a.pgc"

This is necessary not only on Windows but also on UNIX/Linux.  For your
information, running "gcc -E di\\r/a.c" escapes \ and outputs the line:

# 1 "di\\r/a.c"


Regards
MauMau

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Brendan Jurd
Дата:
Сообщение: Re: proposal: simple date constructor from numeric values
Следующее
От: Amit Kapila
Дата:
Сообщение: Re: ALTER SYSTEM SET command to change postgresql.conf parameters (RE: Proposal for Allow postgresql.conf values to be changed via SQL [review])