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

Filter out files that are not ending in .c from c-sources #9200

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 0 additions & 1 deletion cabal-testsuite/PackageTests/CSourcesSanitisation
Submodule CSourcesSanitisation deleted from 8980f3
4 changes: 4 additions & 0 deletions cabal-testsuite/PackageTests/CSourcesSanitisation/Main.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module Main where

main :: IO ()
main = putStrLn "main"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Test.Cabal.Prelude

main = cabalTest $ do
cabal "build"
18 changes: 18 additions & 0 deletions cabal-testsuite/PackageTests/CSourcesSanitisation/cbits/gwinsz.c
Copy link
Collaborator

Choose a reason for hiding this comment

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

I could reproduce with empty files too, if that makes it any easier

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah sure let's go with it 👍

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include <sys/ioctl.h>

unsigned long vty_c_get_window_size(int fd) {
struct winsize w;
if (ioctl (fd, TIOCGWINSZ, &w) >= 0)
return (w.ws_row << 16) + w.ws_col;
else
return 0x190050;
}

void vty_c_set_window_size(int fd, unsigned long val) {
struct winsize w;
if (ioctl(fd, TIOCGWINSZ, &w) >= 0) {
w.ws_row = val >> 16;
w.ws_col = val & 0xFFFF;
ioctl(fd, TIOCSWINSZ, &w);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
unsigned long vty_c_get_window_size(int fd);
unsigned long vty_c_set_window_size(int fd, unsigned long val);
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include <termios.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>

void vty_set_term_timing(int fd, int vmin, int vtime)
{
struct termios trm;
tcgetattr(fd, &trm);
trm.c_cc[VMIN] = vmin;
trm.c_cc[VTIME] = vtime;
tcsetattr(fd, TCSANOW, &trm);
}
26 changes: 26 additions & 0 deletions cabal-testsuite/PackageTests/CSourcesSanitisation/repro.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
cabal-version: 3.0
name: repro
version: 0.1.0.0
build-type: Simple

library
default-language: Haskell2010
c-sources: cbits/set_term_timing.c
cbits/gwinsz.h
cbits/gwinsz.c
build-depends: base

library lib2
default-language: Haskell2010
c-sources: cbits/set_term_timing.c
cbits/gwinsz.h
cbits/gwinsz.c
build-depends: base

executable exec1
main-is: Main.hs
default-language: Haskell2010
c-sources: cbits/set_term_timing.c
cbits/gwinsz.h
cbits/gwinsz.c
build-depends: base