about summary refs log tree commit diff
path: root/sourcecodes/bn_genenet.php
AgeCommit message (Collapse)Author
2026-10-03validate the GN2 payload before prep; informative failures throughoutPjotr
Found by an exhaustive small-payload fuzz (test/fuzz_bnw.py): - bn_genenet.php: fail fast with a plain-English problem list for header-only payloads, ragged rows, single variable/sample, all-NA columns and all-NA rows, non-numeric cells and empty payloads; normalize CRLF and squeeze redundant row separators; rename duplicate variable names with a note (prep used to crash on each of these deep inside octave) - runtime_check.php: exe_time no longer fatals ("int + string") when prep did not produce its tables; falls back to a default estimate - execute_bn_gom.php: the FAILED page gains plain-English hints for the recurring octave failure modes - test/bnw_http_tests.py: tests t22-t33 lock the behaviour in - test/fuzz_bnw.py: the parameter-space fuzzer (75 cases)
2026-10-03bn_genenet: sanitize GN2 trait names containing spacesPjotr
GN2 trait display names often contain spaces ("Age at death"), but BNW's file format does not allow them: the octave parsers split on WHITESPACE (strtok), so a spaced name corrupts the header -- the variable count no longer matches the labels and structure learning dies with "A(0,_): subscripts must be either integers 1 to (2^63)-1 or logicals" in mk_adj_mat (observed on production with a real GN2 dataset). bn_genenet.php now sanitizes the NAME ROW of the GN2 payload (content before the first semicolon, i.e. before the comma->tab conversion): whitespace inside a name becomes an underscore. A wrong first attempt applied the sanitization after the conversion and collapsed the tabs as well, merging all names into one variable. New test t21 posts spaced trait names and runs structure learning through to the rendered SVG. Suite: 27/27 (BNW_LOCAL_SOURCE build).
2026-10-03bn_genenet: accept the GN2 template spelling My_GenenetPjotr
GN2's bnw_page.html posts the payload field as "My_Genenet" (one 'n' in Genenet), while BNW historically read "My_Gennenet" -- the two never matched, so GN2's POST arrived empty and BNW showed its default form (the "Loading data from GeneNetwork" hang). Accept both spellings. New test t18b posts My_Genenet through the legacy /sourcecodes/ action path the template uses. Suite with BNW_LOCAL_SOURCE (this checkout): 26/26.
2026-09-28container: deployment fixes for the Guix container/VMPjotr
Changes previously carried as bnw-container-paths.patch in guix-bioinformatics, now applied to the source directly: * unify data directories on /var/lib/genenet/bnw (was /tmp/bnw and ./data/ mixed) * make the shell_exec paths __DIR__-relative and the example/octave helper scripts location-independent, so php-fpm can run them from any working directory * use core-octave randn/exp instead of the statistics-package normrnd/normpdf (not available in the container's octave) * nnodes: strtrim before strfind so the node count parses with the container's octave output * python3 instead of a hardcoded /home/jziebart path * add diag.php, a debug page showing the request and data state * bn_genenet.php: serve the GeneNetwork (GN2) handshake server-side; the My_Gennenet POST is converted (commas -> tabs, semicolons -> newlines) in PHP and the prepared-data page is returned in ONE request. This removes the raw-echo of into a JavaScript string (an XSS hole on public deployments) and is backward compatible for GN2 (same POST, better response).
2026-08-17Guard fopen() results with a false-check before fwrite/fprintf/fcloseClaude Sonnet 5
On PHP 7.4, calling fwrite()/fprintf()/fclose() with a false handle (a failed fopen(), e.g. from a bad path, missing directory, or permissions issue) just emits a warning and no-ops. On PHP 8.0+, these functions require a resource argument and throw an uncaught TypeError instead, turning what used to be a silent degradation into a fatal crash of the whole request. This patch wraps every fopen()-then-write call site in the codebase (18 files) with an `if ($handle !== false) { ... }` check, matching the existing pattern used elsewhere in the codebase. Where the same $fpvar handle is threaded through shared helper functions (enter_ban_list/banlist/whitelist, duplicated across remove_variables_processing.php, remove_variables_processing_default.php, modify_structure_learning.php and tier_description_processing_gom.php), the guard was added inside those functions too for consistency, even though the call sites are currently dead/commented-out in three of the four files — so the same landmine doesn't reappear if that code is ever re-enabled. Verified empirically against PHP 8.3.28: fopen() on an unwritable path followed by fwrite() on the resulting `false` throws TypeError: fwrite(): Argument #1 ($stream) must be of type resource, false given without the guard; with the guard, the call is skipped instead of crashing. The normal (successful fopen) path was also re-run through mat_structure.php's structure_change() and still produces identical output to before the change. Reviewed by: Frederick M Muriithi <fredmanglis@gmail.com>
2021-10-08Update bn_genenet.phpziejd2
2021-10-08Add files via uploadziejd2