delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2025/10/14/14:59:52

DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 59EIxqjJ3843065
Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com
Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com
DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 59EIxqjJ3843065
Authentication-Results: delorie.com;
dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=kJj6sz1K
X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3CB513858CD1
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1760468390;
bh=qoLO6cfA0BMDuXKivvy+g4Efb4I7+OnQg+UJDyLpY1I=;
h=Date:Subject:To:List-Id:List-Unsubscribe:List-Archive:List-Post:
List-Help:List-Subscribe:From:Reply-To:From;
b=kJj6sz1KCCAyHpoi0GykxaUpG/wDlPn05f4QuZoU7YQFjricch27vySx9uRrLYQXz
zLB+hFApWHOED4eGvUy5S/hou0I7REMUisWKzFygGCzatd27o1k6nErdKgSAs6daRu
Ssa+day9YIKUgxMQwKHArySc4LScc9JVSibViXTU=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5C1533858D35
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5C1533858D35
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1760468364; cv=none;
b=bmAPUrT/rE7KHDcQoawzMRmGxKOdce9bX0+aibOH55oqJZFy2U6v9PiVH411WK78TcIPZtZLcM1HS43dafW8ijKh80HsPePSCMoc3QNjI9CHaraWcMdCG0C2/ob0k4ncTHdpOBvPW/OZBiSD5Vi7HD26mGygyGl7Es+SoieBaf0=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1760468364; c=relaxed/simple;
bh=6WP/aZZ/WAY7kQ0ABQ18cCnlltPBzZuOipS9VFCtnDg=;
h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To;
b=NBV24SttPst9Ppx2DyIO4X6BzwJ5la+IG/ZgGsQ2VcXrkDkDwiMZbm0yuJG3oUwynL5LjFYqFnfF23K6Y0lDUy+v0tv2XMcIWGxe1jjJCZlytyGsUTRegbVnj/vx1RZL3eZTJLWiDzydPpnQRe/BspKgTQbIUeqj5d77zG6LJPA=
ARC-Authentication-Results: i=1; server2.sourceware.org
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5C1533858D35
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1760468363; x=1761073163;
h=to:subject:message-id:date:from:mime-version:x-gm-message-state
:from:to:cc:subject:date:message-id:reply-to;
bh=xjLcbEW69h/mzHlTNqeB135BGy2qNveAA7Tow9ylT9o=;
b=Pc4+aEEmADyyUVfDwi3eTzbjLpWnFRcmvUxlGTZ3nsVukZ8n2DgOnYhFhSgD5rulaO
emEkqJd09Tvc7Vu9lLdrAXw5eCPkzs1/+TIx0VNKI+LDAcPkKqIOlIjaJQXQgRoymDz5
hRcOC1TP5mqAtRUamdpaysTRilcytUGSBywU9ZGogtFqnV31Fx2djE/9AUnmg4RHciHp
Zhpf5DjVIOl/tYZa0C5AbGWu43ULMQOc+sNdKNmNstFfS25CLgEzLqCLv0Q9URfcthnW
E/HcVebwqpACEbunhLkD8sCDTZaT6vWSuHNyG3FVYAS6NMFlE3JCLxvOFiAHlz8ckIs4
hfRA==
X-Gm-Message-State: AOJu0Yzjr/E9pjnHr98j/hSBGSG9AzD69CHSPaZK6BCJGlZfUvvM/MAF
oUi0PoFhI8dNhcqYHB16r/1rxWrfyFcerrYf5BMmPwVRNTZZVoJTRDD6+33uj1Uq1qDljPFOgar
Pk8Wa6K1VQ1JQ2Y8rZDcz16PbF+Xv6ndgNaQ0SXI0Pm3vPGRwMT3rJ9g=
X-Gm-Gg: ASbGncthFLGTqLPOzXo3AiiGA/SE24pMEXBPYKcwzaQjmA2064AFUmsnlO0FmnZl+i6
VOgcy+VjJiJptJ7wZQGVKZIPe1ydHrvBjC1dBP7tQxDdN5z3s8qmE1w3QzsncRdk1onD0HFvSRG
RjwKtzcvN97xonsVZC/COWfwx/cEHQF4cBI2KbDDMUrk/EdGj0UnGCFF+2kfGA66BqTYx/ClLTz
JBDlPxGLIRKWVax+r68jqfQ4r1e8chHEUz5
X-Google-Smtp-Source: AGHT+IFEPqWW2W4JWzQEmXpqW/trDyNOPvIY6ERv16mVkEq+uHolhi5U1s21QPIjuCveFQjd9/f/BjUbI6fuhTh4TmE=
X-Received: by 2002:a17:90b:1805:b0:334:e020:2f16 with SMTP id
98e67ed59e1d1-33b511188a6mr38664870a91.11.1760468363048; Tue, 14 Oct 2025
11:59:23 -0700 (PDT)
MIME-Version: 1.0
Date: Tue, 14 Oct 2025 14:59:11 -0400
X-Gm-Features: AS18NWBxhaC8VmYx47dtNX4XDsHHvNQ9wY9lBRgEjW58fRcrPtwiROhIEQGkaFU
Message-ID: <CAAM_cieBo_M76sqZMGgF+tXxswvT=jUHL_pShff+aRv9P1Eiug@mail.gmail.com>
Subject: Windows App execution alias doesn't forward stdin properly
To: cygwin AT cygwin DOT com
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Cody Tapscott via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Cody Tapscott <cody AT tapscott DOT me>
Sender: "Cygwin" <cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com>

Hello,

I'm trying to create a basic console application on Windows:

#include <stdio.h>
#include <string.h>

int main() {
    char buffer[1024];
    fprintf(stdout, "Enter text: ");
    if (fgets(buffer, sizeof(buffer), stdin)) {
        buffer[strcspn(buffer, "\n")] = '\0';
        fprintf(stdout, "You entered: \"%s\"\n", buffer);
    } else {
        fprintf(stderr, "Error reading input.\n");
        return 1;
    }
    return 0;
}

I compile this with MinGW and bundle it into an app with makeappx.exe
from the Windows SDK:
$ x86_64-w64-mingw32-gcc SimpleApp/simple.c -o SimpleApp/simple.exe
$ /cygdrive/c/Program\ Files\ \(x86\)/Windows\
Kits/10/bin/10.0.26100.0/x64/makeappx pack /d SimpleApp /p Simple.msix
...
Package creation succeeded.

Finally I install this in Powershell using:
PS > Add-AppxPackage -Path .\Simple.msix -AllowUnsigned
PS > Get-AppxPackage -Name "SimpleApp.Simple" | Select-Object
-ExpandProperty InstallLocation
C:\Program Files\WindowsApps\SimpleApp.Simple_1.0.0.0_x64__enwe9x4v0qrt

In Windows Terminal / cmd.exe, this seems to work great.

The problem is that an execution alias does not work under Cygwin / MinTTY:
$ simple_console_app.exe # alias requested in AppxManifest.xml
<hangs in fgets() - nothing is printed to terminal>

However using the application directly from its install path works fine:
$ /cygdrive/c/Program\
Files/WindowsApps/SimpleApp.Simple_1.0.0.0_x64__enwe9x4v0qrtw/simple.exe
Enter text: 1+1
You entered: "1+1"

Is this a conpty or related issue? I don't know how Windows implements
its app execution aliases.

For reference, this is my AppxManifest.xml:
<?xml version="1.0" encoding="utf-8"?>

<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
  xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
  xmlns:uap5="http://schemas.microsoft.com/appx/manifest/uap/windows10/5"
  xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
  xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10"
  xmlns:desktop4="http://schemas.microsoft.com/appx/manifest/desktop/windows10/4"
  IgnorableNamespaces="uap uap5 rescap desktop desktop4">

  <Identity Name="SimpleApp.Simple" Publisher="CN=AppModelSamples,
OID.2.25.311729368913984317654407730594956997722=1" Version="1.0.0.0"
ProcessorArchitecture="x64"/>

  <Properties>
    <DisplayName>SimpleApp</DisplayName>
    <PublisherDisplayName>Simple</PublisherDisplayName>
    <Logo>Logo.png</Logo>
  </Properties>

  <Dependencies>
    <TargetDeviceFamily Name="Windows.Desktop"
MinVersion="10.0.18362.0" MaxVersionTested="10.0.19043.0" />
    <TargetDeviceFamily Name="Windows.Universal"
MinVersion="10.0.18362.0" MaxVersionTested="10.0.19043.0" />
    <PackageDependency Name="Microsoft.VCLibs.140.00.UWPDesktop"
MinVersion="14.0.29231.0" Publisher="CN=Microsoft Corporation,
O=Microsoft Corporation, L=Redmond, S=Washington, C=US" />
  </Dependencies>

  <Resources>
    <Resource Language="en-us"/>
  </Resources>

  <Applications>
    <Application Id="Simple" Executable="simple.exe"
EntryPoint="Windows.FullTrustApplication" desktop4:Subsystem="console"
desktop4:SupportsMultipleInstances="true">
  <uap:VisualElements DisplayName="Simple" Description="Simple console
app" BackgroundColor="transparent" Square150x150Logo="Logo.png"
Square44x44Logo="Logo.png">
        <uap:DefaultTile
          ShortName="SimpleApp">
        </uap:DefaultTile >
      </uap:VisualElements>
      <Extensions>
        <uap5:Extension Category="windows.appExecutionAlias"
Executable="simple.exe" EntryPoint="Windows.FullTrustApplication">
          <uap5:AppExecutionAlias desktop4:Subsystem="console">
            <uap5:ExecutionAlias Alias="simple_console_app.exe" />
          </uap5:AppExecutionAlias>
        </uap5:Extension>
      </Extensions>
    </Application>
  </Applications>

  <Capabilities>
    <rescap:Capability Name="runFullTrust" />
    <rescap:Capability Name="unvirtualizedResources"/>
  </Capabilities>
</Package>

Thanks for any help / insights.

Cody T.

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019