[Bug 2291289] Review Request: ocaml-linenoise - Self-contained OCaml bindings to linenoise, easy high level readline functionality in OCaml

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



https://bugzilla.redhat.com/show_bug.cgi?id=2291289



--- Comment #8 from Jerry James <loganjerry@xxxxxxxxx> ---
The 'c' in 'BSD-3-clause' needs to be capitalized.  License names must match
those in the allowed list exactly
(https://docs.fedoraproject.org/en-US/legal/allowed-licenses/), including
punctuation and capitalization.

The Summary is still too long.  If you don't like my suggested wording in
comment 5, feel free to shorten it yourself.

With regards to the bundled linenoise library, we are supposed to "make every
effort" to avoid it:
https://docs.fedoraproject.org/en-US/packaging-guidelines/#bundling.  In this
case, some effort is needed, but I think it can be done.

Step 1: patch upstream to use the system linenoise library.  That would look
something like this:

--- ocaml-linenoise-1.5.1/src/dune.orig 2024-03-20 13:12:17.000000000 -0600
+++ ocaml-linenoise-1.5.1/src/dune      2024-07-11 15:09:38.626734392 -0600
@@ -5,4 +5,5 @@
   (modules LNoise)
   (wrapped false)
   (flags :standard -warn-error -3)
-  (c_names linenoise_src linenoise_stubs))
+  (c_library_flags -llinenoise)
+  (c_names linenoise_stubs))
--- ocaml-linenoise-1.5.1/src/linenoise_stubs.c.orig    2024-03-20
13:12:17.000000000 -0600
+++ ocaml-linenoise-1.5.1/src/linenoise_stubs.c 2024-07-11 16:07:07.321358220
-0600
@@ -8,7 +8,7 @@
 #include <errno.h>
 #include <assert.h>

-#include "linenoise_src.h"
+#include <linenoise.h>

 // Ripped from ctypes
 #define Val_none Val_int(0)

If that is in a file named unbundle-linenoise.patch, then the spec file would
be altered in the following ways.
- Add:

# Unbundle linenoise
Patch:          unbundle-linenoise.patch

- Remove Provides: bundled(linenoise)
- Add BuildRequires: linenoise-devel
- Do something like this in %prep:

# Ensure the bundled linenoise sources are not used in the build
rm src/linenoise_src.*

Unfortunately, that doesn't work, because upstream has modified the bundled
linenoise library.  They added a variable named linenoiseWasInterrupted.  But
we can deal with that, I think.

Step 2: open a pull request at https://github.com/antirez/linenoise adding the
linenoiseWasInterrupted variable.  For example:

diff --git a/linenoise.c b/linenoise.c
index 574ab1f..d8195f1 100644
--- a/linenoise.c
+++ b/linenoise.c
@@ -159,6 +159,7 @@ enum KEY_ACTION{
 };

 static void linenoiseAtExit(void);
+int linenoiseWasInterrupted = 0;
 int linenoiseHistoryAdd(const char *line);
 #define REFRESH_CLEAN (1<<0)    // Clean the old prompt from the screen
 #define REFRESH_WRITE (1<<1)    // Rewrite the prompt on the screen.
@@ -964,6 +965,7 @@ char *linenoiseEditFeed(struct linenoiseState *l) {
         return strdup(l->buf);
     case CTRL_C:     /* ctrl-c */
         errno = EAGAIN;
+        linenoiseWasInterrupted = 1;
         return NULL;
     case BACKSPACE:   /* backspace */
     case 8:     /* ctrl-h */
diff --git a/linenoise.h b/linenoise.h
index 3f0270e..1ec7e47 100644
--- a/linenoise.h
+++ b/linenoise.h
@@ -45,6 +45,7 @@ extern "C" {

 #include <stddef.h> /* For size_t. */

+extern int linenoiseWasInterrupted; /* nonzero if last keystroke was ctrl-c */
 extern char *linenoiseEditMore;

 /* The linenoiseState structure represents the state during line editing.

Since upstream doesn't seem to accept pull requests very often, that will
probably need to be followed by step 3.

Step 3: open a pull request at https://src.fedoraproject.org/rpms/linenoise
asking the Fedora package maintainer to add the linenoiseWasInterrupted patch,
and point to this review request as the justification.  You might want to also
ask that the library be updated to current git HEAD.

If any of those steps get bogged down, we can consider bundling, but I think we
should give this a try first.


-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are always notified about changes to this product and component
https://bugzilla.redhat.com/show_bug.cgi?id=2291289

Report this comment as SPAM: https://bugzilla.redhat.com/enter_bug.cgi?product=Bugzilla&format=report-spam&short_desc=Report%20of%20Bug%202291289%23c8

-- 
_______________________________________________
package-review mailing list -- package-review@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to package-review-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/package-review@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue




[Index of Archives]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite Conditions]     [KDE Users]

  Powered by Linux