* [devel] NMU: fortune-mod, U: fortunes-ALT
@ 2003-06-01 22:19 Alexey I. Froloff
2003-06-01 23:15 ` Grigory Batalov
0 siblings, 1 reply; 11+ messages in thread
From: Alexey I. Froloff @ 2003-06-01 22:19 UTC (permalink / raw)
To: ALTLinux devel
[-- Attachment #1: Type: text/plain, Size: 642 bytes --]
В /incoming/Sisyphus неспешно заливаются:
8722e3821e1447217413cd196ed7318d fortune-mod-1.0-ipl33mdk.src.rpm
f3bdf22e056be557463611c6860d4967 fortunes-ALT-20030601-alt1.src.rpm
fortune-mod теперь думает, что файлы с фортунками с кодировке
UTF-8 и перед тем как что-то выдавать на экран, текст
перекодируется в "locale charmap". Спасибо Александру Боковому за
working example.
fortunes-ALT теперь в UTF-8 с соответствующими requires'ами.
Заодно добавил ещё цитат и прогнал через iconv ;-)
--
Regards, Sir Raorn.
-------------------
Иначе будет как всегда - кто-то один сделает -> все согласятся и окажется
криво ;-(
-- rider in devel@
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [devel] NMU: fortune-mod, U: fortunes-ALT
2003-06-01 22:19 [devel] NMU: fortune-mod, U: fortunes-ALT Alexey I. Froloff
@ 2003-06-01 23:15 ` Grigory Batalov
2003-06-02 7:46 ` Stanislav Ievlev
2003-06-02 8:18 ` [devel] " Dmitry V. Levin
0 siblings, 2 replies; 11+ messages in thread
From: Grigory Batalov @ 2003-06-01 23:15 UTC (permalink / raw)
To: devel
On Mon, 2 Jun 2003 02:19:32 +0400
"Alexey I. Froloff" <raorn@binec.ru> wrote:
> В /incoming/Sisyphus неспешно заливаются:
>
> 8722e3821e1447217413cd196ed7318d fortune-mod-1.0-ipl33mdk.src.rpm
> f3bdf22e056be557463611c6860d4967 fortunes-ALT-20030601-alt1.src.rpm
"Любое использование tmpnam(3)&Co есть block bug, если только я не сказал
обратного."
-- ldv in sisyphus@
Ой! =) А вот такой кусок -- block bug?
char temp_filename[256];
...
if (!(ptr = getenv ("TMPDIR")))
fatal_error (2, "TMPDIR");
snprintf (temp_filename, 256, "%s/linpopup.XXXXXX", ptr);
file_handle_temp = mkstemp (temp_filename);
write (file_handle_temp, message_text, strlen (message_text));
close (file_handle_temp);
...
unlink (temp_filename);
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [devel] NMU: fortune-mod, U: fortunes-ALT
2003-06-01 23:15 ` Grigory Batalov
@ 2003-06-02 7:46 ` Stanislav Ievlev
2003-06-02 18:38 ` Grigory Batalov
2003-06-02 8:18 ` [devel] " Dmitry V. Levin
1 sibling, 1 reply; 11+ messages in thread
From: Stanislav Ievlev @ 2003-06-02 7:46 UTC (permalink / raw)
To: devel
On Mon, Jun 02, 2003 at 03:15:57AM +0400, Grigory Batalov wrote:
> On Mon, 2 Jun 2003 02:19:32 +0400
> "Alexey I. Froloff" <raorn@binec.ru> wrote:
>
> > В /incoming/Sisyphus неспешно заливаются:
> >
> > 8722e3821e1447217413cd196ed7318d fortune-mod-1.0-ipl33mdk.src.rpm
> > f3bdf22e056be557463611c6860d4967 fortunes-ALT-20030601-alt1.src.rpm
>
>
> "Любое использование tmpnam(3)&Co есть block bug, если только я не сказал
> обратного."
> -- ldv in sisyphus@
>
>
> Ой! =) А вот такой кусок -- block bug?
>
> char temp_filename[256];
Не стоит делать так
> ...
> if (!(ptr = getenv ("TMPDIR")))
> fatal_error (2, "TMPDIR");
Это не фатальная ошибка. надо использовать /tmp если нет TMPDIR.
> snprintf (temp_filename, 256, "%s/linpopup.XXXXXX", ptr);
> file_handle_temp = mkstemp (temp_filename);
> write (file_handle_temp, message_text, strlen (message_text));
> close (file_handle_temp);
> ...
> unlink (temp_filename);
> _______________________________________________
> Devel mailing list
> Devel@altlinux.ru
> http://altlinux.ru/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [devel] NMU: fortune-mod, U: fortunes-ALT
2003-06-01 23:15 ` Grigory Batalov
2003-06-02 7:46 ` Stanislav Ievlev
@ 2003-06-02 8:18 ` Dmitry V. Levin
2003-06-02 9:02 ` Igor Homyakov
2003-06-02 10:48 ` [devel] mkstemp in linpopup (was: NMU: fortune-mod, U: fortunes-ALT) Grigory Batalov
1 sibling, 2 replies; 11+ messages in thread
From: Dmitry V. Levin @ 2003-06-02 8:18 UTC (permalink / raw)
To: ALT Devel discussion list
[-- Attachment #1: Type: text/plain, Size: 758 bytes --]
On Mon, Jun 02, 2003 at 03:15:57AM +0400, Grigory Batalov wrote:
> char temp_filename[256];
256 - маловато будет
> ...
> if (!(ptr = getenv ("TMPDIR")))
> fatal_error (2, "TMPDIR");
Не будет работать, если TMPDIR не определён.
> snprintf (temp_filename, 256, "%s/linpopup.XXXXXX", ptr);
Нет проверки, поместилось ли имя файла в буфер.
> file_handle_temp = mkstemp (temp_filename);
Нет проверки на код возврата.
> write (file_handle_temp, message_text, strlen (message_text));
Запись в непроверенный дескриптор.
> close (file_handle_temp);
> ...
> unlink (temp_filename);
Race condition.
unlink должен быть сразу после mkstemp, и обязательно до close.
Похоже на набор граблей, а не на работоспособный код, верно?
--
ldv
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [devel] NMU: fortune-mod, U: fortunes-ALT
2003-06-02 8:18 ` [devel] " Dmitry V. Levin
@ 2003-06-02 9:02 ` Igor Homyakov
2003-06-02 9:40 ` [devel] " Alexey Tourbin
2003-06-02 10:48 ` [devel] mkstemp in linpopup (was: NMU: fortune-mod, U: fortunes-ALT) Grigory Batalov
1 sibling, 1 reply; 11+ messages in thread
From: Igor Homyakov @ 2003-06-02 9:02 UTC (permalink / raw)
To: ALT Devel discussion list
* Dmitry V. Levin <ldv @ altlinux . org> [030602 12:44]:
> > snprintf (temp_filename, 256, "%s/linpopup.XXXXXX", ptr);
> Нет проверки, поместилось ли имя файла в буфер.
совершенно верно и еще один совет по стилю из
man 3 snprintf OpenBSD 3.3:
Be sure to use the proper secure idiom:
snprintf(buffer, sizeof(buffer), "%s", string);
--
Igor Homyakov
<homyakov at altlinux dot ru>
http://counter.li.org/cgi-bin/runscript/display-person.cgi?user=190141
^ permalink raw reply [flat|nested] 11+ messages in thread
* [devel] Re: NMU: fortune-mod, U: fortunes-ALT
2003-06-02 9:02 ` Igor Homyakov
@ 2003-06-02 9:40 ` Alexey Tourbin
2003-06-02 10:49 ` [devel] Re: printf(3) Igor Homyakov
0 siblings, 1 reply; 11+ messages in thread
From: Alexey Tourbin @ 2003-06-02 9:40 UTC (permalink / raw)
To: ALT Devel discussion list
[-- Attachment #1: Type: text/plain, Size: 272 bytes --]
On Mon, Jun 02, 2003 at 01:02:20PM +0400, Igor Homyakov wrote:
> совершенно верно и еще один совет по стилю из
> man 3 snprintf OpenBSD 3.3:
>
> Be sure to use the proper secure idiom:
>
> snprintf(buffer, sizeof(buffer), "%s", string);
Лучше asprintf.
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* [devel] mkstemp in linpopup (was: NMU: fortune-mod, U: fortunes-ALT)
2003-06-02 8:18 ` [devel] " Dmitry V. Levin
2003-06-02 9:02 ` Igor Homyakov
@ 2003-06-02 10:48 ` Grigory Batalov
1 sibling, 0 replies; 11+ messages in thread
From: Grigory Batalov @ 2003-06-02 10:48 UTC (permalink / raw)
To: devel
On Mon, 2 Jun 2003 12:18:09 +0400
"Dmitry V. Levin" <ldv@altlinux.org> wrote:
> > close (file_handle_temp);
> > ...
> > unlink (temp_filename);
>
> Race condition.
> unlink должен быть сразу после mkstemp, и обязательно до close.
А как же тогда писать в файл, если я его сразу удалю?
> Похоже на набор граблей, а не на работоспособный код, верно?
Ну да, промашка вышла =).
Посоветуйте тогда, где взять образец правильной работы
с временными файлами (или чем это заменить).
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [devel] Re: printf(3)
2003-06-02 9:40 ` [devel] " Alexey Tourbin
@ 2003-06-02 10:49 ` Igor Homyakov
2003-06-03 8:07 ` Dmitry V. Levin
0 siblings, 1 reply; 11+ messages in thread
From: Igor Homyakov @ 2003-06-02 10:49 UTC (permalink / raw)
To: ALT Devel discussion list
* Alexey Tourbin <at @ altlinux . ru> [030602 14:40]:
> On Mon, Jun 02, 2003 at 01:02:20PM +0400, Igor Homyakov wrote:
> > совершенно верно и еще один совет по стилю из
> > man 3 snprintf OpenBSD 3.3:
> >
> > Be sure to use the proper secure idiom:
> >
> > snprintf(buffer, sizeof(buffer), "%s", string);
> Лучше asprintf.
с snprintf есть проблемы с переносимостью у уж про asprintf
у говорить нечего.
--
Igor Homyakov
<homyakov at altlinux dot ru>
http://counter.li.org/cgi-bin/runscript/display-person.cgi?user=190141
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [devel] NMU: fortune-mod, U: fortunes-ALT
2003-06-02 7:46 ` Stanislav Ievlev
@ 2003-06-02 18:38 ` Grigory Batalov
2003-06-03 6:20 ` [devel] " Anton V. Boyarshinov
0 siblings, 1 reply; 11+ messages in thread
From: Grigory Batalov @ 2003-06-02 18:38 UTC (permalink / raw)
To: devel
On Mon, 2 Jun 2003 11:46:55 +0400
Stanislav Ievlev <inger@altlinux.org> wrote:
> > char temp_filename[256];
> Не стоит делать так
В смысле, стоит выделять память динамически?
^ permalink raw reply [flat|nested] 11+ messages in thread
* [devel] Re: NMU: fortune-mod, U: fortunes-ALT
2003-06-02 18:38 ` Grigory Batalov
@ 2003-06-03 6:20 ` Anton V. Boyarshinov
0 siblings, 0 replies; 11+ messages in thread
From: Anton V. Boyarshinov @ 2003-06-03 6:20 UTC (permalink / raw)
To: devel
On Mon, 2 Jun 2003 22:38:07 +0400 Grigory Batalov
wrote:
> On Mon, 2 Jun 2003 11:46:55 +0400
> Stanislav Ievlev <inger@altlinux.org> wrote:
>
> > > char temp_filename[256];
>
> > Не стоит делать так
>
> В смысле, стоит выделять память динамически?
Размер маловат, первую очередь. Я думаю, стоит глянуть в сторону
_POSIX_PATH_MAX.
Антон
--
mailto:boyarsh@mail.ru
mailto:boyarsh@ru.echo.fr
10:16:00 up 8 days, 0 min, 8 users, load average: 0.10, 0.27,
0.15
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [devel] Re: printf(3)
2003-06-02 10:49 ` [devel] Re: printf(3) Igor Homyakov
@ 2003-06-03 8:07 ` Dmitry V. Levin
0 siblings, 0 replies; 11+ messages in thread
From: Dmitry V. Levin @ 2003-06-03 8:07 UTC (permalink / raw)
To: ALT Devel discussion list
[-- Attachment #1: Type: text/plain, Size: 568 bytes --]
On Mon, Jun 02, 2003 at 02:49:21PM +0400, Igor Homyakov wrote:
> * Alexey Tourbin <at @ altlinux . ru> [030602 14:40]:
> > On Mon, Jun 02, 2003 at 01:02:20PM +0400, Igor Homyakov wrote:
> > > совершенно верно и еще один совет по стилю из
> > > man 3 snprintf OpenBSD 3.3:
> > >
> > > Be sure to use the proper secure idiom:
> > >
> > > snprintf(buffer, sizeof(buffer), "%s", string);
>
> > Лучше asprintf.
>
> с snprintf есть проблемы с переносимостью у уж про asprintf
> у говорить нечего.
Существует переносимая реализация asprintf(3).
--
ldv
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2003-06-03 8:07 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-01 22:19 [devel] NMU: fortune-mod, U: fortunes-ALT Alexey I. Froloff
2003-06-01 23:15 ` Grigory Batalov
2003-06-02 7:46 ` Stanislav Ievlev
2003-06-02 18:38 ` Grigory Batalov
2003-06-03 6:20 ` [devel] " Anton V. Boyarshinov
2003-06-02 8:18 ` [devel] " Dmitry V. Levin
2003-06-02 9:02 ` Igor Homyakov
2003-06-02 9:40 ` [devel] " Alexey Tourbin
2003-06-02 10:49 ` [devel] Re: printf(3) Igor Homyakov
2003-06-03 8:07 ` Dmitry V. Levin
2003-06-02 10:48 ` [devel] mkstemp in linpopup (was: NMU: fortune-mod, U: fortunes-ALT) Grigory Batalov
ALT Linux Team development discussions
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
public-inbox-index devel
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.devel
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git