From owner-freebsd-questions@freebsd.org Tue Apr 20 16:29:14 2021 Return-Path: Delivered-To: freebsd-questions@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0F3F75DE8A6 for ; Tue, 20 Apr 2021 16:29:14 +0000 (UTC) (envelope-from pprocacci@gmail.com) Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FPpzY2r7Jz3Cjd for ; Tue, 20 Apr 2021 16:29:13 +0000 (UTC) (envelope-from pprocacci@gmail.com) Received: by mail-pl1-x62c.google.com with SMTP id y1so4308769plg.11 for ; Tue, 20 Apr 2021 09:29:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ZHsLgx0vC9xeSRXpeyv7m2+0muSPOk3KpijvJrIZO/o=; b=gEWgNKpk4V7x24upndfOHspuAYGNnZwSRh8uqnaIVmDP9U3PyPa2ydjjo7rjoIVqv8 SxNaNL7SF9e1/loSqmHmSGoa3GxvVFY48oIXIcn5XRwn/wpWbxoZMQn8utAH7zXmcQ1O K92cz1RIC3rYYyCOp22YjFXaEj4YJ3BQ1wLz1vJ3LpE0zgyo/Oim/JXO57rnDgBkr4h6 ZLSQV7AC03RCpmVHk4RQhe2wW51hq7sjMuTesGpDKYdia5QM29yiJhYyUDPIFmW8jNwx MkhItyXtsZbfBHlPknxrK8xa+A7//pUGKnHLNxHftilRTfM2SADDvYTufx95ZG765+YF MNQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ZHsLgx0vC9xeSRXpeyv7m2+0muSPOk3KpijvJrIZO/o=; b=K3ByZrCYeW55TwdmByu2cVR+wh9a+18RsFToQ9mNZ8WnSA/Og//ovauEnlxc7KjSDL 3UBlORqePzvxlpDxkKDaS4Qx7L0dAUPGh6PiFCLNRpyS0fV51GwAo5afQWbmync8YMSZ cxqae7fMEoDBVPZ8YMmsf7zdepslEdkSZTJyKnxwxUGwmBJBiEPidEMIlQOhaLOfYXyg A7bGk6ygTlkNwPByPKqNusCt/CeS6tkkmLdzTk90BiB6JGfLd8wORgs0QWOaXU/dYVbx FPN5csVyAtLatttlcLCsurwQIdYldjwVfFzojJqnP9yQzH+eY80Ldx3OyGeqIlyoy84s Y40w== X-Gm-Message-State: AOAM531oRIGsZHuLFa8L0jZchxavU48R2IxrZYzoZpPm87CIfv5rKNeW BZK/Dk3CApDDLnOpmikJ3gHPUXfIWqd2CHBScD2nh4h5Hg== X-Google-Smtp-Source: ABdhPJzcKr2VB7z0gH36ooB9GOnUc2WSwefzTsfgGujuPe59TfCCEPcbZHp4FkrURwWFk44CILR5r5Dk/QncUehU960= X-Received: by 2002:a17:902:9a84:b029:ea:e627:f7c2 with SMTP id w4-20020a1709029a84b02900eae627f7c2mr29355276plp.57.1618936151831; Tue, 20 Apr 2021 09:29:11 -0700 (PDT) MIME-Version: 1.0 References: <2ea846ea-65ad-e9ea-9400-2708271039f4@qeng-ho.org> In-Reply-To: <2ea846ea-65ad-e9ea-9400-2708271039f4@qeng-ho.org> From: Paul Procacci Date: Tue, 20 Apr 2021 12:28:59 -0400 Message-ID: Subject: Re: socat / ghostscript questions To: Arthur Chance Cc: byrnejb@harte-lyne.ca, FreeBSD Questions X-Rspamd-Queue-Id: 4FPpzY2r7Jz3Cjd X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=gEWgNKpk; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of pprocacci@gmail.com designates 2607:f8b0:4864:20::62c as permitted sender) smtp.mailfrom=pprocacci@gmail.com X-Spamd-Result: default: False [-2.96 / 15.00]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RBL_DBL_DONT_QUERY_IPS(0.00)[2607:f8b0:4864:20::62c:from]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; NEURAL_SPAM_SHORT(0.04)[0.037]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-questions@freebsd.org]; SPAMHAUS_ZRD(0.00)[2607:f8b0:4864:20::62c:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::62c:from]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[freebsd-questions] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2021 16:29:14 -0000 I tested the N flag and it resulted in some sort of stack trace; I didn't go into it that deeply and may have been easy to fix. /shrug On Tue, Apr 20, 2021 at 12:23 PM Arthur Chance wrote: > On 20/04/2021 17:17, Paul Procacci wrote: > > The hang is most likely because an EOF doesn't get trasmitted over the > wire. > > Adding a timeout I believe should fix the problem. > > > > nc -w 1 [addr] [port] < filename.txt > > Better to use the -N flag. > > -N shutdown(2) the network socket after EOF on the input. Some > servers require this to finish their work. > > > > > On Tue, Apr 20, 2021 at 11:51 AM James B. Byrne via freebsd-questions < > > freebsd-questions@freebsd.org> wrote: > > > >> I am trying to produce pdf files using socat and ghostscript. I have > this > >> command for socat: > >> > >> socat TCP4-LISTEN:9100,bind=192.168.216.41,fork,reuseaddr SYSTEM:'gs > >> -dQUIET > >> -dNOPROMPT -dBATCH -sDEVICE=pdfwrite -sOutputFile=/tmp/\"$(date > >> -Iseconds)\".pdf -' > >> > >> > >> Which I try to send a text file to using cat and nc: > >> > >> cat sshpipe3.txt | nc 192.168.216.41 9100 > >> > >> > >> What happens is that the cat/nc pipe hangs. This is probably an > artifact > >> of > >> how nc works but I need to check that is so. When I terminate nc with > >> -c > >> the socat gs instance reports an error: > >> > >> GPL Ghostscript 9.52: Unrecoverable error, exit code 1 > >> 2021/04/20 11:32:51 socat[67296] E write(6, 0x800adf000, 128): Broken > pipe > >> > >> This produces an empty file named like > /tmp/2021-04-20T11:13:20-04:00.pdf. > >> > >> I am no doubt missing the obvious here so I have a few naive questions: > >> > >> 1. Is it possible to terminate the sending process without causing GS to > >> issue > >> an error? > >> > >> 2. Would printing from another host to that socat instance result in the > >> same > >> broken pipe error? > >> > >> 3. Why are the files that gs creates empty? > >> > >> 4. How do I send a text file to the socat instance so that it is > converted > >> to a > >> pdf document? > >> > > > > > > -- > Lebowskisort, aka dudesort, an O(1) sorting algorithm: > > "Man, the array is cool as it is. Let's go bowling." > -- __________________ :(){ :|:& };: