poudriere icon indicating copy to clipboard operation
poudriere copied to clipboard

poudriere.js should allow colons in jail names for example FreeBSD:13:amd64

Open alan-hicks opened this issue 2 years ago • 0 comments

Prerequisites

  • [yes] Have you checked for an existing issue describing your problem?
  • [yes] Are you running the latest version?
  • [yes] Is your ports tree recent?
  • [yes] Is your FreeBSD Host on a supported release?

Describe the bug

When a jail name includes a colon, JavaScript barfs with the error: Uncaught Error: Syntax error, unrecognized expression: unsupported pseudo: 13

pkg uses colons in the ${ABI} for identification and poudriere creates directory names with colons, (not jails names), facilitating integration.

The html standard allows an id to be any non whitespace characters: https://html.spec.whatwg.org/#the-id-attribute There are no other restrictions on what form an ID can take; in particular, IDs can consist of just digits, start with a digit, start with an underscore, consist of just punctuation, etc.

jQuery is confused because a colon can be a pseudo element such as :animated and :button https://api.jquery.com/category/selectors/

Although the list of meta characters that jQuery recommend replacing is large, see above link, in practice this will be a directory name and thus likely to be very limited.

How to reproduce

Create a jail using a name from a package ABI such as FreeBSD:14:amd64 Run a poudriere bulk job Load poudriere.example.com in a browser to check progress and the error message will stop further polls for .data.json

Expected behavior

poudriere.js should work with names as per pkg ${ABI}

Environment

  • Host OS [any]:
  • Jail OS [any]:
  • Browser: [firefox]:
  • Poudriere Version: [3.3.7]
  • Ports branch and revision [current]:

Patch

The following patch globally replaces colons with underscores

diff -u poudriere.bak.js poudriere.js
--- poudriere.bak.js    2022-08-20 10:01:14.634260000 +0100
+++ poudriere.js        2022-08-20 10:07:58.996104000 +0100
@@ -511,7 +511,7 @@
                 * replace its data. Don't bother with lookups on
                 * first load.
                 */
-               row.DT_RowId = 'data_row_' + row.id;
+               row.DT_RowId = 'data_row_' + row.id.replace(/:/g, '_');
                if (!this.first_load) {
                        existing_row = this.Table.row('#' + row.DT_RowId);
                } else {

alan-hicks avatar Aug 20 '22 10:08 alan-hicks