OVH Cloud OVH Cloud

application patch

3 réponses
Avatar
messmate
Bonjour,
cela fait une =E9ternit=E9 que j'ai encore appliqu=E9 un patch.
Le apt-get nous rend beb=EAte, non ?
J'ai l=E0 un texte en clair que je dois appliquer en tant que patch =E0 mon=
postfix 2.2.
Quelqu'un se souviens comment faire ?
mess-mate

3 réponses

Avatar
tnemeth
Selon messmate :

| Bonjour,

Bonjour.


| cela fait une éternité que j'ai encore appliqué un patch.
| Le apt-get nous rend bebête, non ?

Non.


| J'ai là un texte en clair que je dois appliquer en tant que patch à
| mon postfix 2.2.
| Quelqu'un se souviens comment faire ?

Est-ce que "lire la page de man de patch" te dit quelquechose ?
patch -pX < fichier-patch.diff

Avec X == le niveau de patch (généralement 0).

Thomas.


--
Pensez à lire la FAQ de la liste avant de poser une question :
http://wiki.debian.net/?DebianFrench

Pensez à rajouter le mot ``spam'' dans vos champs "From" et "Reply-To:"

To UNSUBSCRIBE, email to
with a subject of "unsubscribe". Trouble? Contact
Avatar
messmate
On Tue, 29 Mar 2005 10:34:13 +0200
wrote:

Selon messmate :

| Bonjour,

Bonjour.


| cela fait une éternité que j'ai encore appliqué un patch.
| Le apt-get nous rend bebête, non ?

Non.


| J'ai là un texte en clair que je dois appliquer en tant que patch à
| mon postfix 2.2.
| Quelqu'un se souviens comment faire ?

Est-ce que "lire la page de man de patch" te dit quelquechose ?



OUI...

patch -pX < fichier-patch.diff

Avec X == le niveau de patch (généralement 0).

Thomas.



Voilà:
patch -p0 cleanup_message.c cleanup_message.diff
patching file cleanup_message.c
Hunk #1 FAILED at 296.
Hunk #2 succeeded at 307 with fuzz 1 (offset -2 lines).
Hunk #3 FAILED at 321.
Hunk #4 FAILED at 339.
Hunk #5 FAILED at 364.
Hunk #6 FAILED at 392.
Hunk #7 FAILED at 400.
Hunk #8 FAILED at 455.
Hunk #9 FAILED at 670.
8 out of 9 hunks FAILED -- saving rejects to file cleanup_message.c.rej

Et ceci est le reject:
***************
*** 296,303 ****

/* cleanup_act - act upon a header/body match */

! static int cleanup_act(CLEANUP_STATE *state, char *context, const char *b uf,
! const char *value, const char *map_class)
{
const char *optional_text = value + strcspn(value, " t");
int command_len = optional_text - value;
--- 296,304 ----

/* cleanup_act - act upon a header/body match */

! static const char *cleanup_act(CLEANUP_STATE *state, char *context,
! const char *buf, const char *value,
! const char *map_class)
{
const char *optional_text = value + strcspn(value, " t");
int command_len = optional_text - value;
***************
*** 321,331 ****
state->errs |= CLEANUP_STAT_CONT;
state->flags &= ~CLEANUP_FLAG_FILTER;
cleanup_act_log(state, "reject", context, buf, state->reason);
! return (CLEANUP_ACT_KEEP);
}
if (STREQUAL(value, "WARN", command_len)) {
cleanup_act_log(state, "warning", context, buf, optional_text);
! return (CLEANUP_ACT_KEEP);
}
if (STREQUAL(value, "FILTER", command_len)) {
if (*optional_text == 0) {
--- 321,331 ----
state->errs |= CLEANUP_STAT_CONT;
state->flags &= ~CLEANUP_FLAG_FILTER;
cleanup_act_log(state, "reject", context, buf, state->reason);
! return (buf);
}
if (STREQUAL(value, "WARN", command_len)) {
cleanup_act_log(state, "warning", context, buf, optional_text);
! return (buf);
}
if (STREQUAL(value, "FILTER", command_len)) {
if (*optional_text == 0) {
***************
*** 339,356 ****
state->filter = mystrdup(optional_text);
cleanup_act_log(state, "filter", context, buf, optional_text);
}
! return (CLEANUP_ACT_KEEP);
}
if (STREQUAL(value, "DISCARD", command_len)) {
cleanup_act_log(state, "discard", context, buf, optional_text);
state->flags |= CLEANUP_FLAG_DISCARD;
state->flags &= ~CLEANUP_FLAG_FILTER;
! return (CLEANUP_ACT_KEEP);
}
if (STREQUAL(value, "HOLD", command_len)) {
cleanup_act_log(state, "hold", context, buf, optional_text);
state->flags |= CLEANUP_FLAG_HOLD;
! return (CLEANUP_ACT_KEEP);
}
if (STREQUAL(value, "PREPEND", command_len)) {
if (*optional_text == 0) {
--- 339,356 ----
state->filter = mystrdup(optional_text);
cleanup_act_log(state, "filter", context, buf, optional_text);
}
! return (buf);
}
if (STREQUAL(value, "DISCARD", command_len)) {
cleanup_act_log(state, "discard", context, buf, optional_text);
state->flags |= CLEANUP_FLAG_DISCARD;
state->flags &= ~CLEANUP_FLAG_FILTER;
! return (buf);
}
if (STREQUAL(value, "HOLD", command_len)) {
cleanup_act_log(state, "hold", context, buf, optional_text);
state->flags |= CLEANUP_FLAG_HOLD;
! return (buf);
}
if (STREQUAL(value, "PREPEND", command_len)) {
if (*optional_text == 0) {
***************
*** 364,391 ****
cleanup_act_log(state, "prepend", context, buf, optional_text);
cleanup_out_string(state, REC_TYPE_NORM, optional_text);
}
! return (CLEANUP_ACT_KEEP);
}
if (STREQUAL(value, "REPLACE", command_len)) {
if (*optional_text == 0) {
msg_warn("REPLACE action without text in %s map", map_class);
! return (CLEANUP_ACT_KEEP);
! } else if (strcmp(context, CLEANUP_ACT_CTXT_HEADER) == 0) {
! if (!is_header(optional_text)) {
! msg_warn("bad REPLACE header text "%s" in %s map, "
! "need "headername: headervalue"",
! optional_text, map_class);
! return (CLEANUP_ACT_KEEP);
! }
! /* XXX Impedance mismatch. */
! bp = vstring_strcpy(vstring_alloc(100), optional_text);
! cleanup_out_header(state, bp);
! vstring_free(bp);
} else {
! cleanup_out_string(state, REC_TYPE_NORM, optional_text);
}
- cleanup_act_log(state, "replace", context, buf, optional_text);
- return (CLEANUP_ACT_DROP);
}
if (STREQUAL(value, "REDIRECT", command_len)) {
if (strchr(optional_text, '@') == 0) {
--- 364,385 ----
cleanup_act_log(state, "prepend", context, buf, optional_text);
cleanup_out_string(state, REC_TYPE_NORM, optional_text);
}
! return (buf);
}
if (STREQUAL(value, "REPLACE", command_len)) {
if (*optional_text == 0) {
msg_warn("REPLACE action without text in %s map", map_class);
! return (buf);
! } else if (strcmp(context, CLEANUP_ACT_CTXT_HEADER) == 0
! && !is_header(optional_text)) {
! msg_warn("bad REPLACE header text "%s" in %s map, "
! "need "headername: headervalue"",
! optional_text, map_class);
! return (buf);
} else {
! cleanup_act_log(state, "replace", context, buf, optional_text);
! return (mystrdup(optional_text));
}
}
if (STREQUAL(value, "REDIRECT", command_len)) {
if (strchr(optional_text, '@') == 0) {
***************
*** 398,404 ****
cleanup_act_log(state, "redirect", context, buf, optional_text);
state->flags &= ~CLEANUP_FLAG_FILTER;
}
! return (CLEANUP_ACT_KEEP);
}
/* Allow and ignore optional text after the action. */

--- 392,398 ----
cleanup_act_log(state, "redirect", context, buf, optional_text);
state->flags &= ~CLEANUP_FLAG_FILTER;
}
! return (buf);
}
/* Allow and ignore optional text after the action. */

***************
*** 406,418 ****
return (CLEANUP_ACT_DROP);

if (STREQUAL(value, "DUNNO", command_len)) /* preferred */
! return (CLEANUP_ACT_KEEP);

if (STREQUAL(value, "OK", command_len)) /* compat */
! return (CLEANUP_ACT_KEEP);

msg_warn("unknown command in %s map: %s", map_class, value);
! return (CLEANUP_ACT_KEEP);
}

/* cleanup_header_callback - process one complete header line */
--- 400,412 ----
return (CLEANUP_ACT_DROP);

if (STREQUAL(value, "DUNNO", command_len)) /* preferred */
! return (buf);

if (STREQUAL(value, "OK", command_len)) /* compat */
! return (buf);

msg_warn("unknown command in %s map: %s", map_class, value);
! return (buf);
}

/* cleanup_header_callback - process one complete header line */
***************
*** 461,470 ****
const char *value;

if ((value = maps_find(checks, header, 0)) != 0) {
! if (cleanup_act(state, CLEANUP_ACT_CTXT_HEADER,
! header, value, map_class)
! == CLEANUP_ACT_DROP)
return;
}
}

--- 455,470 ----
const char *value;

if ((value = maps_find(checks, header, 0)) != 0) {
! const char *result;
!
! if ((result = cleanup_act(state, CLEANUP_ACT_CTXT_HEADER,
! header, value, map_class))
! == CLEANUP_ACT_DROP) {
return;
+ } else if (result != header) {
+ vstring_strcpy(header_buf, result);
+ myfree((char *) result);
+ }
}
}

***************
*** 670,679 ****
const char *value;

if ((value = maps_find(cleanup_body_checks, buf, 0)) != 0) {
! if (cleanup_act(state, CLEANUP_ACT_CTXT_BODY,
! buf, value, VAR_BODY_CHECKS)
! == CLEANUP_ACT_DROP)
return;
}
}
cleanup_out(state, type, buf, len);
--- 670,686 ----
const char *value;

if ((value = maps_find(cleanup_body_checks, buf, 0)) != 0) {
! const char *result;
!
! if ((result = cleanup_act(state, CLEANUP_ACT_CTXT_BODY,
! buf, value, VAR_BODY_CHECKS))
! == CLEANUP_ACT_DROP) {
! return;
! } else if (result != buf) {
! cleanup_out(state, type, result, strlen(result));
! myfree((char *) result);
return;
+ }
}
}
cleanup_out(state, type, buf, len);

mess-mate
Avatar
tnemeth
Selon messmate :

| On Tue, 29 Mar 2005 10:34:13 +0200
| wrote:
|
| > | J'ai là un texte en clair que je dois appliquer en tant que patch
| à
| > | mon postfix 2.2.
| > | Quelqu'un se souviens comment faire ?
| >
| > Est-ce que "lire la page de man de patch" te dit quelquechose ?
|
| OUI...

Ah :)
Bin fallait regarder dedans directement, ça aurait été plus simple.


| > patch -pX < fichier-patch.diff
| >
| > Avec X == le niveau de patch (généralement 0).
|
| Voilà:
| patch -p0 cleanup_message.c cleanup_message.diff

Erk. Je n'ai jamais aimé cette façon de l'utiliser :)


| patching file cleanup_message.c
| Hunk #1 FAILED at 296.
| Hunk #2 succeeded at 307 with fuzz 1 (offset -2 lines).
| Hunk #3 FAILED at 321.
| Hunk #4 FAILED at 339.
| Hunk #5 FAILED at 364.
| Hunk #6 FAILED at 392.
| Hunk #7 FAILED at 400.
| Hunk #8 FAILED at 455.
| Hunk #9 FAILED at 670.
| 8 out of 9 hunks FAILED -- saving rejects to file
| cleanup_message.c.rej

Vérifie que le patch que tu appliques est bien pour la version
du logiciel que tu as installé. Visiblement il trouve le fichier
malgré ta ligne de commande un peu cavalière, et il réussi à
appliquer un morceau du patch (le hunk #2) mais pas les autres.
C'est généralement dû à 2 choses :
- le mec qui a pondu le patch l'a fait avec les pieds.
- le source que tu essayes de patcher a été modifié entre le
moment où le patche a été créé et celui où tu l'appliques.

Le derniers cas m'est souvent arrivé en tentant de patcher le
noyau avec des trucs bizarres. Il arrive souvent, dans ces cas-là,
qu'en plus, le mec qui a pondu le diff, n'utilise pas toutes les
options qui pourraient aider l'utilisateur du patch (en
particulier l'option de diff qui permet d'indiquer dans quelle
fonction se trouve la modif du "hunk").


Thomas.


--
Pensez à lire la FAQ de la liste avant de poser une question :
http://wiki.debian.net/?DebianFrench

Pensez à rajouter le mot ``spam'' dans vos champs "From" et "Reply-To:"

To UNSUBSCRIBE, email to
with a subject of "unsubscribe". Trouble? Contact