Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add telescope+libretls port #196

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion bootstrap.d/dev-libs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,34 @@ packages:
- args: ['make', 'install']
environ:
DESTDIR: '@THIS_COLLECT_DIR@'

- name: libretls
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This port lacks meta data. Is it necessary to use this package? We already have OpenSSL.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

libretls is a libtls reimplementation of libtls for openssl

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aside from missing metadata and architecture labels, ports should have one empty line between them. And yes, we need libretls or make telescope link against libressl, which I'm against. Gentoo has libretls in their repo's too, so this is fine.

source:
subdir: 'ports'
git: 'https://git.causal.agency/libretls'
tag: '3.5.2'
version: '3.5.2'
tools_required:
- host-autoconf-v2.69
- host-automake-v1.15
- host-libtool
regenerate:
- args: ['autoreconf', '-fi']
tools_required:
- system-gcc
pkgs_required:
- mlibc
- openssl
configure:
- args:
- '@THIS_SOURCE_DIR@/configure'
- '--host=@OPTION:arch-triple@'
- '--prefix=/usr'
- '--disable-static'
build:
- args: ['make', '-j@PARALLELISM@']
- args: ['make', 'install']
environ:
DESTDIR: '@THIS_COLLECT_DIR@'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, newline after a port recipe.

- name: libtasn
labels: [aarch64]
architecture: '@OPTION:arch@'
Expand Down
37 changes: 37 additions & 0 deletions bootstrap.d/www-client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,40 @@ packages:
- args: ['make', 'DESTDIR=@THIS_COLLECT_DIR@', 'install']
environ:
DESTDIR: '@THIS_COLLECT_DIR@'
- name: telescope
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, a newline should be added between ports.

architecture: '@OPTION:arch@'
metadata:
summary: CLI Gemini Client
description: This package contains a CLI Geminispace browser
website: 'https://telescope.omarpolo.com/'
maintainer: "Alexander Richards <[email protected]>"
categories: ['www-client']
source:
subdir: 'ports'
git: 'https://github.com/omar-polo/telescope'
tag: '0.8.1'
version: '0.8.1'
tools_required:
- host-autoconf-v2.69
- host-automake-v1.15
- host-autoconf-archive
- host-pkg-config
- host-libtool
regenerate:
- args: ['./autogen.sh']
tools_required:
- system-gcc
pkgs_required:
- mlibc
- libretls
- openssl
- ncurses
configure:
- args:
- '@THIS_SOURCE_DIR@/configure'
- '--host=x86_64-managarm'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should use - '--host=@OPTION:arch-triple@' instead of hardcoding architectures here.

- '--prefix=/usr'
- '--mandir=/usr/share/man'
build:
- args: ['make', 'all-am', '-j@PARALLELISM@', 'HOSTCC=gcc']
- args: ['make', 'install-am', 'DESTDIR=@THIS_COLLECT_DIR@']
73 changes: 73 additions & 0 deletions patches/telescope/0001-Managarm-Patches.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
From 084d8d40a24a601c463955ac569183cfb085f96a Mon Sep 17 00:00:00 2001
From: Alexander <[email protected]>
Date: Thu, 16 Jun 2022 00:31:32 +0200
Subject: [PATCH] Managarm Patches

---
control.c | 14 ++++++++------
telescope.c | 9 +++++----
2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/control.c b/control.c
index b2cba81..dc2cdcd 100644
--- a/control.c
+++ b/control.c
@@ -91,12 +91,14 @@ control_init(char *path)
}
umask(old_umask);

- if (chmod(path, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP) == -1) {
- warn("%s: chmod", __func__);
- close(fd);
- (void)unlink(path);
- return (-1);
- }
+
+ // patched because chmod == nop
+ //if (chmod(path, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP) == -1) {
+ // warn("%s: chmod", __func__);
+ // close(fd);
+ // (void)unlink(path);
+ // return (-1);
+ //}

return (fd);
}
diff --git a/telescope.c b/telescope.c
index 0a65f41..1991d1b 100644
--- a/telescope.c
+++ b/telescope.c
@@ -64,7 +64,7 @@ int operating;
* "Safe" (or "sandobox") mode. If enabled, Telescope shouldn't write
* anything to the filesystem or execute external programs.
*/
-int safe_mode;
+int safe_mode = 0;
Comment on lines +44 to +45
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't do anything since global vars are initialized to zero anyway.


static struct imsgev *iev_net;

@@ -1047,8 +1047,8 @@ main(int argc, char * const *argv)

if (getenv("NO_COLOR") != NULL)
enable_colors = 0;
-
- while ((ch = getopt_long(argc, argv, opts, longopts, NULL)) != -1) {
+ optind = 0;
+ while ((ch = getopt(argc, argv, opts)) != -1) {
Comment on lines +54 to +56
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this done?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working around unimplemented/incorrectly implemented functionality in getopt_long. The optind = 0 can be dropped, though.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then getopt_long should be fixed instead of hacking around such issues here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See managarm/mlibc#438 for the fix.

switch (ch) {
case 'C':
exit(ui_print_colors());
@@ -1128,8 +1128,9 @@ main(int argc, char * const *argv)
"telescope already running?");
}

+
/* Start children. */
- if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, pipe2net) == -1)
+ if (socketpair(AF_UNIX, SOCK_STREAM, 0, pipe2net) == -1)
Comment on lines +66 to +67
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this done? If we're missing PF_UNSPEC, adding it to mlibc should be simple.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have it, however Managarm code asserts that the protocol (3rd argument) is 0. We should change the Managarm code to allow PF_UNSPEC (which is basically pick what you think is best afaik).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

upstream is wrong here afaik, from posix:

       protocol    Specifies  a  particular  protocol  to be used with the socket. Specifying a protocol of 0 causes socket() to use an unspecified default
                   protocol appropriate for the requested socket type.

err(1, "socketpair");
start_child(PROC_NET, argv0, pipe2net[1]);
imsg_init(&net_ibuf.ibuf, pipe2net[0]);
--
2.36.1