Bug 22552 - Univention Debug: Init sollte den File-Deskriptor zurückgeben
Univention Debug: Init sollte den File-Deskriptor zurückgeben
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: General
UNSTABLE
Other Linux
: P5 minor (vote)
: UCS 3.0 - MS2
Assigned To: Andreas Büsching
Felix Botner
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-05-17 17:27 CEST by Andreas Büsching
Modified: 2019-05-22 11:59 CEST (History)
2 users (show)

See Also:
What kind of report is it?: ---
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments
init returns file descriptor to open logfile (3.19 KB, patch)
2011-05-17 17:28 CEST, Andreas Büsching
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Büsching univentionstaff 2011-05-17 17:27:17 CEST
univention.debug.init öffnet die Log-Datei und in den Python-Bindings kommt man nicht an den FD dazu. Es wäre gut, wenn init den Deskriptor zurückgibt. dann könnte ein Dienst, der alle Desriptoren schließt den einen auslassen.
Comment 1 Andreas Büsching univentionstaff 2011-05-17 17:28:40 CEST
Created attachment 3280 [details]
init returns file descriptor to open logfile
Comment 2 Andreas Büsching univentionstaff 2011-05-18 09:01:26 CEST
Eine Version mit dem Patch ist jetzt gebaut
Comment 3 Stefan Gohmann univentionstaff 2011-06-07 15:34:06 CEST
In debug.h habe ich noch ein "#include <stdio.h>" hinzugfügt, da FILE ansonsten unbekannt war:

gcc -g -Wall -D_FILE_OFFSET_BITS=64 -I/usr/include/db -DWITH_DB48   -c -o cache_entry.o cache_entry.c
In file included from cache_entry.c:38:
/usr/include/univention/debug.h:109: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
Comment 4 Andreas Büsching univentionstaff 2011-09-22 09:38:16 CEST
Die init-Funktion gibt den Descriptor zurück. ChangeLog hinzugefügt
Comment 5 Felix Botner univentionstaff 2011-09-29 11:48:02 CEST
OK

#include <univention/debug.h>
#include <stdio.h>

int main(void) {
        FILE *fp;
        char *logfile = "/tmp/debugtest.log";
        fp = univention_debug_init(logfile, UV_DEBUG_FLUSH, UV_DEBUG_FUNCTION);
        univention_debug(UV_DEBUG_POLICY, UV_DEBUG_ERROR, "error");
        fprintf(fp, "Testing...\n");
        univention_debug_exit();
        return 0;
}

-> more /tmp/debugtest.log 
29.09.11 01:18:32.648  DEBUG_INIT
29.09.11 01:18:32.649  POLICY      ( ERROR   ) : error
Testing...
29.09.11 01:18:32.649  DEBUG_EXIT

import univention.debug
fp =  univention.debug.init('/tmp/aaa.log', 1, 1)
univention.debug.debug(univention.debug.ADMIN, univention.debug.ERROR, 'error')
fp.write("Testing...\n")
fp.close()
univention.debug.exit()

-> more /tmp/aaa.log 
29.09.11 01:20:53.393  DEBUG_INIT
29.09.11 01:20:53.393  ADMIN       ( ERROR   ) : error
Testing...
29.09.11 01:20:53.394  DEBUG_EXIT

Changelog Eintrag vorhanden.
Comment 6 Sönke Schwardt-Krummrich univentionstaff 2011-12-13 15:41:32 CET
UCS 3.0-0 wurde veröffentlicht. Sollte der hier beschriebene Bug mit einer
neueren Version von UCS erneut auftreten, so sollte dieser Bug dupliziert werden:
"Clone This Bug"