Download raw body.
got_diffreg temporary patch
On Fri, Jan 24, 2020 at 01:56:27PM -0700, Tracey Emery wrote:
> Hello,
>
> During some clean-up of gotweb's diffing, I traced down a problem in
> got_diffreg, which I discussed with stsp. The problem is that /dev/null
> is opened when a file is NULL during diffing.
>
> Naturally, this device doesn't exist in the httpd(8) chroot, so when the
> function is called, diffing is terminated in gotweb resulting in
> incomplete diffs.
>
> I'd like to get this temporary patch in until more time is available for
> hacking a better solution. This way, if someone wants to play with
> gotweb in the interem, the user will get full diffs.
>
> Ok?
Won't this change leave empty files around in /tmp? The temp files will
be closed but won't be removed from disk.
I think leaving f1 or f2 as NULL and checking for NULL everywhere else
inside the diffreg code would be a better solution.
> diff 65559f29d05d29688f1aaca93a9398148be5154b /home/basepr1me/Documents/got/got/got
> blob - ba57c9a9820650433f49ef21d5eff17b52d34763
> file + lib/diffreg.c
> --- lib/diffreg.c
> +++ lib/diffreg.c
> @@ -92,6 +92,12 @@
>
> #include "got_lib_diff.h"
>
> +/*
> + * XXX:band-aid patch include
> + * remove when proper patch in place
> + */
> +#include <got_opentemp.h>
> +
> #define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
> #define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b))
>
> @@ -305,7 +311,7 @@ got_diffreg(int *rval, FILE *f1, FILE *f2, int flags,
> return NULL;
> }
> if (flags & D_EMPTY1) {
> - f1 = fopen(_PATH_DEVNULL, "r");
> + f1 = got_opentemp();
> if (f1 == NULL) {
> err = got_error_from_errno2("fopen", _PATH_DEVNULL);
> goto closem;
> @@ -317,7 +323,7 @@ got_diffreg(int *rval, FILE *f1, FILE *f2, int flags,
> }
>
> if (flags & D_EMPTY2) {
> - f2 = fopen(_PATH_DEVNULL, "r");
> + f2 = got_opentemp();
> if (f2 == NULL) {
> err = got_error_from_errno2("fopen", _PATH_DEVNULL);
> goto closem;
>
>
got_diffreg temporary patch