From owner-svn-src-user@FreeBSD.ORG Sun Jul 12 00:27:54 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CD1821065673; Sun, 12 Jul 2009 00:27:54 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BAFEC8FC12; Sun, 12 Jul 2009 00:27:54 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n6C0RsZr067391; Sun, 12 Jul 2009 00:27:54 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n6C0RsdW067389; Sun, 12 Jul 2009 00:27:54 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200907120027.n6C0RsdW067389@svn.freebsd.org> From: Kip Macy Date: Sun, 12 Jul 2009 00:27:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r195629 - user/kmacy/head_ppacket/sys/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Jul 2009 00:27:55 -0000 Author: kmacy Date: Sun Jul 12 00:27:54 2009 New Revision: 195629 URL: http://svn.freebsd.org/changeset/base/195629 Log: - avoid reference counting problem with rtentry by not keeping softc route structure keep just an rtentry instead - be careful to distinguish between passed in route and cached rtentry Modified: user/kmacy/head_ppacket/sys/net/if_gre.c Modified: user/kmacy/head_ppacket/sys/net/if_gre.c ============================================================================== --- user/kmacy/head_ppacket/sys/net/if_gre.c Sat Jul 11 22:57:02 2009 (r195628) +++ user/kmacy/head_ppacket/sys/net/if_gre.c Sun Jul 12 00:27:54 2009 (r195629) @@ -63,6 +63,7 @@ #include #include #include +#include #include #include @@ -97,8 +98,7 @@ struct gre_softc { */ int gre_refcnt; u_int gre_fibnum; /* use this fib for envelopes */ - struct route route; /* routing entry that determines, where a - encapsulated packet should go */ + struct rtentry *gre_rt; const struct encaptab *encap; /* encapsulation cookie */ int called; /* infinite recursion preventer */ @@ -308,8 +308,15 @@ gre_output(struct ifnet *ifp, struct mbu struct mobile_h mob_h; u_int32_t af; int extra = 0; + struct route lro; + + memset(&lro, 0, sizeof(struct route)); + ((struct sockaddr_in *)&lro.ro_dst)->sin_addr = sc->gre_dst; + lro.ro_dst.sa_family = AF_INET; + lro.ro_dst.sa_len = sizeof(lro.ro_dst); GRE_LOCK(sc); + lro.ro_rt = sc->gre_rt; /* * gre may cause infinite recursion calls when misconfigured. * We'll prevent this by introducing upper limit. @@ -504,7 +511,7 @@ gre_output(struct ifnet *ifp, struct mbu * overwriting the ip_id again. ip_id is already set to the * ip_id of the encapsulated packet. */ - error = ip_output(m, NULL, &sc->route, IP_FORWARDING, + error = ip_output(m, NULL, (ro != NULL) ? ro : &lro, IP_FORWARDING, (struct ip_moptions *)NULL, (struct inpcb *)NULL); end: GRE_UNLOCK(sc); @@ -686,8 +693,8 @@ gre_ioctl(struct ifnet *ifp, u_long cmd, printf("%s: unable to attach encap\n", if_name(GRE2IFP(sc))); #endif - if (sc->route.ro_rt != 0) /* free old route */ - RTFREE(sc->route.ro_rt); + if (sc->gre_rt != NULL) /* free old route */ + RTFREE(sc->gre_rt); if (gre_compute_route(sc) == 0) ifp->if_drv_flags |= IFF_DRV_RUNNING; else @@ -850,14 +857,12 @@ gre_ioctl(struct ifnet *ifp, u_long cmd, static int gre_compute_route(struct gre_softc *sc) { - struct route *ro; - - ro = &sc->route; + struct route ro; - memset(ro, 0, sizeof(struct route)); - ((struct sockaddr_in *)&ro->ro_dst)->sin_addr = sc->gre_dst; - ro->ro_dst.sa_family = AF_INET; - ro->ro_dst.sa_len = sizeof(ro->ro_dst); + memset(&ro, 0, sizeof(struct route)); + ((struct sockaddr_in *)&ro.ro_dst)->sin_addr = sc->gre_dst; + ro.ro_dst.sa_family = AF_INET; + ro.ro_dst.sa_len = sizeof(ro.ro_dst); /* * toggle last bit, so our interface is not found, but a less @@ -866,29 +871,28 @@ gre_compute_route(struct gre_softc *sc) * XXX MRT Use a different FIB for the tunnel to solve this problem. */ if ((GRE2IFP(sc)->if_flags & IFF_LINK1) == 0) { - ((struct sockaddr_in *)&ro->ro_dst)->sin_addr.s_addr ^= + ((struct sockaddr_in *)&ro.ro_dst)->sin_addr.s_addr ^= htonl(0x01); } #ifdef DIAGNOSTIC printf("%s: searching for a route to %s", if_name(GRE2IFP(sc)), - inet_ntoa(((struct sockaddr_in *)&ro->ro_dst)->sin_addr)); + inet_ntoa(((struct sockaddr_in *)&ro.ro_dst)->sin_addr)); #endif - rtalloc_fib(ro, sc->gre_fibnum); - + rtalloc_fib(&ro, sc->gre_fibnum); + sc->gre_rt = ro.ro_rt; /* * check if this returned a route at all and this route is no * recursion to ourself */ - if (ro->ro_rt == NULL || ro->ro_rt->rt_ifp->if_softc == sc) { -#ifdef DIAGNOSTIC - if (ro->ro_rt == NULL) - printf(" - no route found!\n"); + if (ro.ro_rt == NULL || ro.ro_rt->rt_ifp->if_softc == sc) { + if (ro.ro_rt == NULL) + log(LOG_ERR, " - no route found!\n"); else - printf(" - route loops back to ourself!\n"); -#endif - return EADDRNOTAVAIL; + log(LOG_ERR, " - route loops back to ourself!\n"); + RTFREE(ro.ro_rt); + return (EADDRNOTAVAIL); } /* @@ -896,11 +900,11 @@ gre_compute_route(struct gre_softc *sc) * the route and search one to this interface ... */ if ((GRE2IFP(sc)->if_flags & IFF_LINK1) == 0) - ((struct sockaddr_in *)&ro->ro_dst)->sin_addr = sc->gre_dst; + ((struct sockaddr_in *)&ro.ro_dst)->sin_addr = sc->gre_dst; #ifdef DIAGNOSTIC - printf(", choosing %s with gateway %s", if_name(ro->ro_rt->rt_ifp), - inet_ntoa(((struct sockaddr_in *)(ro->ro_rt->rt_gateway))->sin_addr)); + printf(", choosing %s with gateway %s", if_name(ro.ro_rt->rt_ifp), + inet_ntoa(((struct sockaddr_in *)(ro.ro_rt->rt_gateway))->sin_addr)); printf("\n"); #endif From owner-svn-src-user@FreeBSD.ORG Sun Jul 12 08:05:20 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 77333106566B; Sun, 12 Jul 2009 08:05:20 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 3A2F08FC0C; Sun, 12 Jul 2009 08:05:20 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 931D546B53; Sun, 12 Jul 2009 04:05:19 -0400 (EDT) Date: Sun, 12 Jul 2009 09:05:19 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Kip Macy In-Reply-To: <200907112257.n6BMv3Vm065726@svn.freebsd.org> Message-ID: References: <200907112257.n6BMv3Vm065726@svn.freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r195628 - user/kmacy/head_ppacket/sys/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Jul 2009 08:05:20 -0000 On Sat, 11 Jul 2009, Kip Macy wrote: > Author: kmacy > Date: Sat Jul 11 22:57:02 2009 > New Revision: 195628 > URL: http://svn.freebsd.org/changeset/base/195628 > > Log: > - remove tun_pid - TUN_OPEN is used to avoid multiple users FWIW, I think my comment about tun_pid is not 100% correct. For the purposes of the kernel implementation, it's true that it is used only for the purpose I describe. However, I think it's also reported to userspace when status is queried so that ifconfig can printf the pid of the process that opened (although not necessarily the one still using) the tunnel device. > - make teardown of the ifaddr list SMP / PREEMPTION safe As I recall, these paths are hard to lock correctly due to calling out to other code that not only modifies the same lists, but also acquires address list locks, etc. Per our chat last night, I'm aware of the issue and will try to take a look at it soon. It similarly affects other code paths that do the same sorts of things -- walk per-ifnet address lists and then rtinit each address, etc. Robert N M Watson Computer Laboratory University of Cambridge > - add tun_rwait_cv to avoid TUN_RWAIT setting sleep / wakeup dance > - serialize access to softc structures every place they're touched > - remove spl in all places where the tun lock now protects state > > Modified: > user/kmacy/head_ppacket/sys/net/if_tun.c > > Modified: user/kmacy/head_ppacket/sys/net/if_tun.c > ============================================================================== > --- user/kmacy/head_ppacket/sys/net/if_tun.c Sat Jul 11 22:43:20 2009 (r195627) > +++ user/kmacy/head_ppacket/sys/net/if_tun.c Sat Jul 11 22:57:02 2009 (r195628) > @@ -76,25 +76,18 @@ struct tun_softc { > #define TUN_IASET 0x0008 > #define TUN_DSTADDR 0x0010 > #define TUN_LMODE 0x0020 > -#define TUN_RWAIT 0x0040 > + > #define TUN_ASYNC 0x0080 > #define TUN_IFHEAD 0x0100 > > #define TUN_READY (TUN_OPEN | TUN_INITED) > > - /* > - * XXXRW: tun_pid is used to exclusively lock /dev/tun. Is this > - * actually needed? Can we just return EBUSY if already open? > - * Problem is that this involved inherent races when a tun device > - * is handed off from one process to another, as opposed to just > - * being slightly stale informationally. > - */ > - pid_t tun_pid; /* owning pid */ > struct ifnet *tun_ifp; /* the interface */ > struct sigio *tun_sigio; /* information for async I/O */ > struct selinfo tun_rsel; /* read select */ > struct mtx tun_mtx; /* protect mutable softc fields */ > struct cv tun_cv; /* protect against ref'd dev destroy */ > + struct cv tun_rwait_cv; /* rwait wakeup */ > }; > #define TUN2IFP(sc) ((sc)->tun_ifp) > > @@ -347,10 +340,7 @@ tunstart(struct ifnet *ifp) > } > > mtx_lock(&tp->tun_mtx); > - if (tp->tun_flags & TUN_RWAIT) { > - tp->tun_flags &= ~TUN_RWAIT; > - wakeup(tp); > - } > + cv_broadcast(&tp->tun_rwait_cv); > if (tp->tun_flags & TUN_ASYNC && tp->tun_sigio) { > mtx_unlock(&tp->tun_mtx); > pgsigio(&tp->tun_sigio, SIGIO, 0); > @@ -371,7 +361,8 @@ tuncreate(const char *name, struct cdev > > sc = malloc(sizeof(*sc), M_TUN, M_WAITOK | M_ZERO); > mtx_init(&sc->tun_mtx, "tun_mtx", NULL, MTX_DEF); > - cv_init(&sc->tun_cv, "tun_condvar"); > + cv_init(&sc->tun_cv, "tun_ref_cv"); > + cv_init(&sc->tun_rwait_cv, "tun_rwait_cv"); > sc->tun_flags = TUN_INITED; > sc->tun_dev = dev; > mtx_lock(&tunmtx); > @@ -417,18 +408,11 @@ tunopen(struct cdev *dev, int flag, int > tp = dev->si_drv1; > } > > - /* > - * XXXRW: This use of tun_pid is subject to error due to the > - * fact that a reference to the tunnel can live beyond the > - * death of the process that created it. Can we replace this > - * with a simple busy flag? > - */ > mtx_lock(&tp->tun_mtx); > - if (tp->tun_pid != 0 && tp->tun_pid != td->td_proc->p_pid) { > + if (tp->tun_flags & TUN_OPEN) { > mtx_unlock(&tp->tun_mtx); > return (EBUSY); > } > - tp->tun_pid = td->td_proc->p_pid; > > tp->tun_flags |= TUN_OPEN; > mtx_unlock(&tp->tun_mtx); > @@ -448,36 +432,37 @@ tunclose(struct cdev *dev, int foo, int > { > struct tun_softc *tp; > struct ifnet *ifp; > - int s; > - > + struct ifaddrhead head; > + > tp = dev->si_drv1; > ifp = TUN2IFP(tp); > - > + > + TAILQ_INIT(&head); > mtx_lock(&tp->tun_mtx); > tp->tun_flags &= ~TUN_OPEN; > - tp->tun_pid = 0; > mtx_unlock(&tp->tun_mtx); > > /* > * junk all pending output > */ > CURVNET_SET(ifp->if_vnet); > - s = splimp(); > IFQ_PURGE(&ifp->if_snd); > - splx(s); > > if (ifp->if_flags & IFF_UP) { > - s = splimp(); > + mtx_lock(&tp->tun_mtx); > if_down(ifp); > - splx(s); > + mtx_unlock(&tp->tun_mtx); > } > > /* Delete all addresses and routes which reference this interface. */ > if (ifp->if_drv_flags & IFF_DRV_RUNNING) { > struct ifaddr *ifa; > > - s = splimp(); > - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { > + while (!TAILQ_EMPTY(&ifp->if_addrhead)) { > + IF_ADDR_LOCK(ifp); > + ifa = TAILQ_FIRST(&ifp->if_addrhead); > + TAILQ_REMOVE(&ifp->if_addrhead, ifa, ifa_link); > + IF_ADDR_UNLOCK(ifp); > /* deal w/IPv4 PtP destination; unlocked read */ > if (ifa->ifa_addr->sa_family == AF_INET) { > rtinit(ifa, (int)RTM_DELETE, > @@ -486,9 +471,13 @@ tunclose(struct cdev *dev, int foo, int > rtinit(ifa, (int)RTM_DELETE, 0); > } > } > + IF_ADDR_LOCK(ifp); > + TAILQ_CONCAT(&ifp->if_addrhead, &head, ifa_link); > if_purgeaddrs(ifp); > + IF_ADDR_UNLOCK(ifp); > + mtx_lock(&tp->tun_mtx); > ifp->if_drv_flags &= ~IFF_DRV_RUNNING; > - splx(s); > + mtx_unlock(&tp->tun_mtx); > } > if_link_state_change(ifp, LINK_STATE_DOWN); > CURVNET_RESTORE(); > @@ -507,12 +496,13 @@ tunclose(struct cdev *dev, int foo, int > static int > tuninit(struct ifnet *ifp) > { > + int error = 0; > #ifdef INET > struct tun_softc *tp = ifp->if_softc; > struct ifaddr *ifa; > + > + mtx_assert(&tp->tun_mtx, MA_OWNED); > #endif > - int error = 0; > - > TUNDEBUG(ifp, "tuninit\n"); > > ifp->if_flags |= IFF_UP; > @@ -526,14 +516,12 @@ tuninit(struct ifnet *ifp) > struct sockaddr_in *si; > > si = (struct sockaddr_in *)ifa->ifa_addr; > - mtx_lock(&tp->tun_mtx); > if (si->sin_addr.s_addr) > tp->tun_flags |= TUN_IASET; > > si = (struct sockaddr_in *)ifa->ifa_dstaddr; > if (si && si->sin_addr.s_addr) > tp->tun_flags |= TUN_DSTADDR; > - mtx_unlock(&tp->tun_mtx); > } > } > if_addr_runlock(ifp); > @@ -550,17 +538,12 @@ tunifioctl(struct ifnet *ifp, u_long cmd > struct ifreq *ifr = (struct ifreq *)data; > struct tun_softc *tp = ifp->if_softc; > struct ifstat *ifs; > - int error = 0, s; > + int error = 0; > > - s = splimp(); > + mtx_lock(&tp->tun_mtx); > switch(cmd) { > case SIOCGIFSTATUS: > ifs = (struct ifstat *)data; > - mtx_lock(&tp->tun_mtx); > - if (tp->tun_pid) > - sprintf(ifs->ascii + strlen(ifs->ascii), > - "\tOpened by PID %d\n", tp->tun_pid); > - mtx_unlock(&tp->tun_mtx); > break; > case SIOCSIFADDR: > error = tuninit(ifp); > @@ -581,7 +564,7 @@ tunifioctl(struct ifnet *ifp, u_long cmd > default: > error = EINVAL; > } > - splx(s); > + mtx_unlock(&tp->tun_mtx); > return (error); > } > > @@ -687,7 +670,6 @@ tunoutput( > static int > tunioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td) > { > - int s; > int error; > struct tun_softc *tp = dev->si_drv1; > struct tuninfo *tunp; > @@ -758,11 +740,6 @@ tunioctl(struct cdev *dev, u_long cmd, c > return(EINVAL); > } > break; > - case TUNSIFPID: > - mtx_lock(&tp->tun_mtx); > - tp->tun_pid = curthread->td_proc->p_pid; > - mtx_unlock(&tp->tun_mtx); > - break; > case FIONBIO: > break; > case FIOASYNC: > @@ -774,7 +751,6 @@ tunioctl(struct cdev *dev, u_long cmd, c > mtx_unlock(&tp->tun_mtx); > break; > case FIONREAD: > - s = splimp(); > if (!IFQ_IS_EMPTY(&TUN2IFP(tp)->if_snd)) { > struct mbuf *mb; > IFQ_LOCK(&TUN2IFP(tp)->if_snd); > @@ -784,7 +760,6 @@ tunioctl(struct cdev *dev, u_long cmd, c > IFQ_UNLOCK(&TUN2IFP(tp)->if_snd); > } else > *(int *)data = 0; > - splx(s); > break; > case FIOSETOWN: > return (fsetown(*(int *)data, &tp->tun_sigio)); > @@ -818,7 +793,7 @@ tunread(struct cdev *dev, struct uio *ui > struct tun_softc *tp = dev->si_drv1; > struct ifnet *ifp = TUN2IFP(tp); > struct mbuf *m; > - int error=0, len, s; > + int error=0, len; > > TUNDEBUG (ifp, "read\n"); > mtx_lock(&tp->tun_mtx); > @@ -827,29 +802,21 @@ tunread(struct cdev *dev, struct uio *ui > TUNDEBUG (ifp, "not ready 0%o\n", tp->tun_flags); > return (EHOSTDOWN); > } > - > - tp->tun_flags &= ~TUN_RWAIT; > mtx_unlock(&tp->tun_mtx); > > - s = splimp(); > do { > IFQ_DEQUEUE(&ifp->if_snd, m); > if (m == NULL) { > if (flag & O_NONBLOCK) { > - splx(s); > return (EWOULDBLOCK); > } > mtx_lock(&tp->tun_mtx); > - tp->tun_flags |= TUN_RWAIT; > + error = cv_wait_sig(&tp->tun_rwait_cv, &tp->tun_mtx); > mtx_unlock(&tp->tun_mtx); > - if ((error = tsleep(tp, PCATCH | (PZERO + 1), > - "tunread", 0)) != 0) { > - splx(s); > + if (error) > return (error); > - } > } > } while (m == NULL); > - splx(s); > > while (m && uio->uio_resid > 0 && error == 0) { > len = min(uio->uio_resid, m->m_len); > @@ -962,13 +929,11 @@ tunwrite(struct cdev *dev, struct uio *u > static int > tunpoll(struct cdev *dev, int events, struct thread *td) > { > - int s; > struct tun_softc *tp = dev->si_drv1; > struct ifnet *ifp = TUN2IFP(tp); > int revents = 0; > struct mbuf *m; > > - s = splimp(); > TUNDEBUG(ifp, "tunpoll\n"); > > if (events & (POLLIN | POLLRDNORM)) { > @@ -986,7 +951,6 @@ tunpoll(struct cdev *dev, int events, st > if (events & (POLLOUT | POLLWRNORM)) > revents |= events & (POLLOUT | POLLWRNORM); > > - splx(s); > return (revents); > } > > @@ -1034,12 +998,11 @@ tunkqfilter(struct cdev *dev, struct kno > static int > tunkqread(struct knote *kn, long hint) > { > - int ret, s; > + int ret; > struct cdev *dev = (struct cdev *)(kn->kn_hook); > struct tun_softc *tp = dev->si_drv1; > struct ifnet *ifp = TUN2IFP(tp); > > - s = splimp(); > if ((kn->kn_data = ifp->if_snd.ifq_len) > 0) { > TUNDEBUG(ifp, > "%s have data in the queue. Len = %d, minor = %#x\n", > @@ -1051,7 +1014,6 @@ tunkqread(struct knote *kn, long hint) > dev2unit(dev)); > ret = 0; > } > - splx(s); > > return (ret); > } > @@ -1062,13 +1024,12 @@ tunkqread(struct knote *kn, long hint) > static int > tunkqwrite(struct knote *kn, long hint) > { > - int s; > struct tun_softc *tp = ((struct cdev *)kn->kn_hook)->si_drv1; > struct ifnet *ifp = TUN2IFP(tp); > > - s = splimp(); > + mtx_lock(&tp->tun_mtx); > kn->kn_data = ifp->if_mtu; > - splx(s); > + mtx_unlock(&tp->tun_mtx); > > return (1); > } > From owner-svn-src-user@FreeBSD.ORG Sun Jul 12 21:48:06 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 88771106566C; Sun, 12 Jul 2009 21:48:06 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 779F88FC35; Sun, 12 Jul 2009 21:48:06 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n6CLm6Lp095949; Sun, 12 Jul 2009 21:48:06 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n6CLm6lG095947; Sun, 12 Jul 2009 21:48:06 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200907122148.n6CLm6lG095947@svn.freebsd.org> From: Kip Macy Date: Sun, 12 Jul 2009 21:48:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r195646 - user/kmacy/head_ppacket/sys/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Jul 2009 21:48:06 -0000 Author: kmacy Date: Sun Jul 12 21:48:06 2009 New Revision: 195646 URL: http://svn.freebsd.org/changeset/base/195646 Log: fix GRE2IFP macro Modified: user/kmacy/head_ppacket/sys/net/if_gre.h Modified: user/kmacy/head_ppacket/sys/net/if_gre.h ============================================================================== --- user/kmacy/head_ppacket/sys/net/if_gre.h Sun Jul 12 20:17:31 2009 (r195645) +++ user/kmacy/head_ppacket/sys/net/if_gre.h Sun Jul 12 21:48:06 2009 (r195646) @@ -58,9 +58,9 @@ typedef enum { * The binary contract is to have the ifp at the front of the softc * */ -#define GRE2IFP(sc) (*(struct ifnet **)(&sc)) +#define GRE2IFP(sc) (((struct gre_softc_external *)(sc))->g_ifp) struct gre_softc_external { - struct ifnet *gre_ifp; + struct ifnet *g_ifp; struct in_addr g_src; /* source address of gre packets */ struct in_addr g_dst; /* destination address of gre packets */ u_char g_proto; /* protocol of encapsulator */ From owner-svn-src-user@FreeBSD.ORG Sun Jul 12 22:01:10 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3F78B106566C; Sun, 12 Jul 2009 22:01:10 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2ED7D8FC1E; Sun, 12 Jul 2009 22:01:10 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n6CM1AVx096253; Sun, 12 Jul 2009 22:01:10 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n6CM1AgR096251; Sun, 12 Jul 2009 22:01:10 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200907122201.n6CM1AgR096251@svn.freebsd.org> From: Kip Macy Date: Sun, 12 Jul 2009 22:01:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r195647 - user/kmacy/head_ppacket/sys/i386/conf X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Jul 2009 22:01:10 -0000 Author: kmacy Date: Sun Jul 12 22:01:09 2009 New Revision: 195647 URL: http://svn.freebsd.org/changeset/base/195647 Log: reduce modules built Modified: user/kmacy/head_ppacket/sys/i386/conf/GENERIC Modified: user/kmacy/head_ppacket/sys/i386/conf/GENERIC ============================================================================== --- user/kmacy/head_ppacket/sys/i386/conf/GENERIC Sun Jul 12 21:48:06 2009 (r195646) +++ user/kmacy/head_ppacket/sys/i386/conf/GENERIC Sun Jul 12 22:01:09 2009 (r195647) @@ -33,6 +33,7 @@ ident GENERIC # env "GENERIC.env" makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols +makeoptions MODULES_OVERRIDE="zlib mxge if_gre pf" options SCHED_ULE # ULE scheduler options PREEMPTION # Enable kernel thread preemption From owner-svn-src-user@FreeBSD.ORG Sun Jul 12 22:19:51 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 565AE106566B; Sun, 12 Jul 2009 22:19:51 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2B2E88FC0A; Sun, 12 Jul 2009 22:19:51 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n6CMJpNw096596; Sun, 12 Jul 2009 22:19:51 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n6CMJp6d096594; Sun, 12 Jul 2009 22:19:51 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200907122219.n6CMJp6d096594@svn.freebsd.org> From: Kip Macy Date: Sun, 12 Jul 2009 22:19:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r195648 - user/kmacy/head_ppacket/sys/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Jul 2009 22:19:51 -0000 Author: kmacy Date: Sun Jul 12 22:19:50 2009 New Revision: 195648 URL: http://svn.freebsd.org/changeset/base/195648 Log: add debugging foo Modified: user/kmacy/head_ppacket/sys/net/if_gre.c Modified: user/kmacy/head_ppacket/sys/net/if_gre.c ============================================================================== --- user/kmacy/head_ppacket/sys/net/if_gre.c Sun Jul 12 22:01:09 2009 (r195647) +++ user/kmacy/head_ppacket/sys/net/if_gre.c Sun Jul 12 22:19:50 2009 (r195648) @@ -209,17 +209,17 @@ greattach(void) } static int -gre_clone_create(ifc, unit, params) - struct if_clone *ifc; - int unit; - caddr_t params; +gre_clone_create(struct if_clone *ifc, int unit, caddr_t params) { struct gre_softc *sc; - + struct ifnet *ifp; + sc = malloc(sizeof(struct gre_softc), M_GRE, M_WAITOK | M_ZERO); - GRE2IFP(sc) = if_alloc(IFT_TUNNEL); - if (GRE2IFP(sc) == NULL) { + GRE2IFP(sc) = ifp = if_alloc(IFT_TUNNEL); + printf("gre_clone_create: ifp == %p GRE2IFP(sc) == %p\n", ifp, + GRE2IFP(sc)); + if (ifp == NULL) { free(sc, M_GRE); return (ENOSPC); } @@ -227,26 +227,26 @@ gre_clone_create(ifc, unit, params) mtx_init(&sc->gre_mtx, sc->sc_mtx_buf, NULL, MTX_DEF); sc->gre_refcnt = 1; - GRE2IFP(sc)->if_softc = sc; - if_initname(GRE2IFP(sc), ifc->ifc_name, unit); + ifp->if_softc = sc; + if_initname(ifp, ifc->ifc_name, unit); - GRE2IFP(sc)->if_snd.ifq_maxlen = IFQ_MAXLEN; - GRE2IFP(sc)->if_addrlen = 0; - GRE2IFP(sc)->if_hdrlen = 24; /* IP + GRE */ - GRE2IFP(sc)->if_mtu = GREMTU; - GRE2IFP(sc)->if_flags = IFF_POINTOPOINT|IFF_MULTICAST; - GRE2IFP(sc)->if_output = gre_output; - GRE2IFP(sc)->if_ioctl = gre_ioctl; + ifp->if_snd.ifq_maxlen = IFQ_MAXLEN; + ifp->if_addrlen = 0; + ifp->if_hdrlen = 24; /* IP + GRE */ + ifp->if_mtu = GREMTU; + ifp->if_flags = IFF_POINTOPOINT|IFF_MULTICAST; + ifp->if_output = gre_output; + ifp->if_ioctl = gre_ioctl; sc->gre_dst.s_addr = sc->gre_src.s_addr = INADDR_ANY; sc->gre_proto = IPPROTO_GRE; - GRE2IFP(sc)->if_flags |= IFF_LINK0; + ifp->if_flags |= IFF_LINK0; sc->encap = NULL; sc->called = 0; sc->gre_fibnum = curthread->td_proc->p_fibnum; sc->gre_wccp_ver = WCCP_V1; sc->key = 0; - if_attach(GRE2IFP(sc)); - bpfattach(GRE2IFP(sc), DLT_NULL, sizeof(u_int32_t)); + if_attach(ifp); + bpfattach(ifp, DLT_NULL, sizeof(u_int32_t)); mtx_lock(&gre_mtx); LIST_INSERT_HEAD(&gre_softc_list, sc, sc_list); mtx_unlock(&gre_mtx); From owner-svn-src-user@FreeBSD.ORG Mon Jul 13 01:02:37 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5198A106566C; Mon, 13 Jul 2009 01:02:37 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3E6B38FC27; Mon, 13 Jul 2009 01:02:37 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n6D12a3K099789; Mon, 13 Jul 2009 01:02:36 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n6D12a6U099787; Mon, 13 Jul 2009 01:02:36 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200907130102.n6D12a6U099787@svn.freebsd.org> From: Kip Macy Date: Mon, 13 Jul 2009 01:02:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r195650 - user/kmacy/head_ppacket/sys/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Jul 2009 01:02:37 -0000 Author: kmacy Date: Mon Jul 13 01:02:36 2009 New Revision: 195650 URL: http://svn.freebsd.org/changeset/base/195650 Log: don't RTFREE null rtentry Modified: user/kmacy/head_ppacket/sys/net/if_gre.c Modified: user/kmacy/head_ppacket/sys/net/if_gre.c ============================================================================== --- user/kmacy/head_ppacket/sys/net/if_gre.c Sun Jul 12 23:31:20 2009 (r195649) +++ user/kmacy/head_ppacket/sys/net/if_gre.c Mon Jul 13 01:02:36 2009 (r195650) @@ -217,8 +217,10 @@ gre_clone_create(struct if_clone *ifc, i sc = malloc(sizeof(struct gre_softc), M_GRE, M_WAITOK | M_ZERO); GRE2IFP(sc) = ifp = if_alloc(IFT_TUNNEL); +#ifdef DIAGNOSTIC printf("gre_clone_create: ifp == %p GRE2IFP(sc) == %p\n", ifp, GRE2IFP(sc)); +#endif if (ifp == NULL) { free(sc, M_GRE); return (ENOSPC); @@ -889,9 +891,10 @@ gre_compute_route(struct gre_softc *sc) if (ro.ro_rt == NULL || ro.ro_rt->rt_ifp->if_softc == sc) { if (ro.ro_rt == NULL) log(LOG_ERR, " - no route found!\n"); - else + else { log(LOG_ERR, " - route loops back to ourself!\n"); - RTFREE(ro.ro_rt); + RTFREE(ro.ro_rt); + } return (EADDRNOTAVAIL); } From owner-svn-src-user@FreeBSD.ORG Thu Jul 16 21:54:41 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6CA0B106564A; Thu, 16 Jul 2009 21:54:41 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5B2378FC08; Thu, 16 Jul 2009 21:54:41 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n6GLsf3E042578; Thu, 16 Jul 2009 21:54:41 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n6GLsfhe042576; Thu, 16 Jul 2009 21:54:41 GMT (envelope-from des@svn.freebsd.org) Message-Id: <200907162154.n6GLsfhe042576@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Thu, 16 Jul 2009 21:54:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r195728 - user/des/fmerge X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Jul 2009 21:54:41 -0000 Author: des Date: Thu Jul 16 21:54:41 2009 New Revision: 195728 URL: http://svn.freebsd.org/changeset/base/195728 Log: Fix arg parsing Modified: user/des/fmerge/fmerge.pl Modified: user/des/fmerge/fmerge.pl ============================================================================== --- user/des/fmerge/fmerge.pl Thu Jul 16 21:13:04 2009 (r195727) +++ user/des/fmerge/fmerge.pl Thu Jul 16 21:54:41 2009 (r195728) @@ -163,13 +163,13 @@ MAIN:{ if ($ARGV[0] eq 'all') { shift; } else { - while (@ARGV && $ARGV[0] =~ m/^r?\d+(,r?\d+)*$/) { + while (@ARGV && $ARGV[0] =~ m/^[cr]?\d+([-:][cr]?\d+)?(,[cr]?\d+([-:][cr]?\d+)?)*$/) { foreach my $rev (split(',', $ARGV[0])) { if ($rev =~ m/^[cr]?(\d+)$/) { push(@revs, [ $1 - 1, $1 ]); } elsif ($rev =~ m/^[cr]?-(\d+)$/) { push(@revs, [ $1, $1 - 1 ]); - } elsif ($rev =~ m/^r?(\d+)[-:](\d+)$/) { + } elsif ($rev =~ m/^[cr]?(\d+)[-:][cr]?(\d+)$/) { push(@revs, [ $1, $2 ]); } else { usage(); From owner-svn-src-user@FreeBSD.ORG Thu Jul 16 22:24:57 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E9DB7106564A; Thu, 16 Jul 2009 22:24:57 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BE2B78FC13; Thu, 16 Jul 2009 22:24:57 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n6GMOvuT044213; Thu, 16 Jul 2009 22:24:57 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n6GMOvJw044212; Thu, 16 Jul 2009 22:24:57 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200907162224.n6GMOvJw044212@svn.freebsd.org> From: Edwin Groothuis Date: Thu, 16 Jul 2009 22:24:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r195729 - user/edwin/locale X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Jul 2009 22:24:58 -0000 Author: edwin Date: Thu Jul 16 22:24:57 2009 New Revision: 195729 URL: http://svn.freebsd.org/changeset/base/195729 Log: See how good we can merge the data from the CLDR Project (http://cldr.unicode.org/) and the data in src/share/{monet|numeric|msg|time}def Added: user/edwin/locale/ From owner-svn-src-user@FreeBSD.ORG Thu Jul 16 22:30:12 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3911110656BC; Thu, 16 Jul 2009 22:30:12 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 264248FC20; Thu, 16 Jul 2009 22:30:12 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n6GMUCZm044656; Thu, 16 Jul 2009 22:30:12 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n6GMUCMo044652; Thu, 16 Jul 2009 22:30:12 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200907162230.n6GMUCMo044652@svn.freebsd.org> From: Edwin Groothuis Date: Thu, 16 Jul 2009 22:30:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r195730 - user/edwin/locale/tools X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Jul 2009 22:30:12 -0000 Author: edwin Date: Thu Jul 16 22:30:11 2009 New Revision: 195730 URL: http://svn.freebsd.org/changeset/base/195730 Log: For in src/tools/tools/locale: tools/charmaps.xml - datafile with the languages, countries and encodings. tools/cldr2def.pl - convertor from the CLDR data. tools/charmaps.pm - interface between the XML data file and the perl script. Added: user/edwin/locale/tools/ user/edwin/locale/tools/charmaps.pm user/edwin/locale/tools/charmaps.xml user/edwin/locale/tools/cldr2def.pl (contents, props changed) Added: user/edwin/locale/tools/charmaps.pm ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/locale/tools/charmaps.pm Thu Jul 16 22:30:11 2009 (r195730) @@ -0,0 +1,99 @@ +#!/usr/local/bin/perl -w + +use strict; +use XML::Parser; +use Data::Dumper; + +my %data = (); +my %d = (); +my $index = -1; + +sub get_xmldata { + open(FIN, "charmaps.xml"); + my @xml = ; + chomp(@xml); + close(FIN); + + my $xml = new XML::Parser(Handlers => { + Start => \&h_start, + End => \&h_end, + Char => \&h_char + }); + $xml->parse(join("", @xml)); + return %d; +} + +sub h_start { + my $expat = shift; + my $element = shift; + my @attrs = @_; + my %attrs = (); + + + while ($#attrs >= 0) { + $attrs{$attrs[0]} = $attrs[1]; + shift(@attrs); + shift(@attrs); + } + + $data{element}{++$index} = $element; + + if ($element eq "language") { + my $name = $attrs{name}; + my $encoding = $attrs{encoding}; + my $countries = $attrs{countries}; + my $family = $attrs{family}; + my $f = defined $attrs{family} ? $attrs{family} : "x"; + my $link = $attrs{link}; + my $fallback = $attrs{fallback}; + + $d{L}{$name}{$f}{fallback} = $fallback; + $d{L}{$name}{$f}{link} = $link; + $d{L}{$name}{$f}{family} = $family; + $d{L}{$name}{$f}{encoding} = $encoding; + $d{L}{$name}{$f}{countries} = $countries; + foreach my $c (split(" ", $countries)) { + if (defined $encoding) { + foreach my $e (split(" ", $encoding)) { + $d{L}{$name}{$f}{data}{$c}{$e} = undef; + } + } + $d{L}{$name}{$f}{data}{$c}{"UTF-8"} = undef; + } + return; + } + + if ($element eq "translation") { + if (defined $attrs{hex}) { + my $k = "<" . $attrs{cldr} . ">"; + my $hs = $attrs{hex}; + $d{T}{$attrs{encoding}}{$k} = ""; + while ($hs ne "") { + $d{T}{$attrs{encoding}}{$k} .= + chr(hex(substr($hs, 0, 2))); + $hs = substr($hs, 2); + } + } + if (defined $attrs{string}) { + $d{T}{$attrs{encoding}}{"<" . $attrs{cldr} . ">"} = + $attrs{string}; + } + return; + } +} + +sub h_end { + my $expat = shift; + my $element = shift; + $index--; +} + +sub h_char { + my $expat = shift; + my $string = shift; +} + +#use Data::Dumper; +#my %D = get_xmldata(); +#print Dumper(%D); +1; Added: user/edwin/locale/tools/charmaps.xml ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/locale/tools/charmaps.xml Thu Jul 16 22:30:11 2009 (r195730) @@ -0,0 +1,237 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Added: user/edwin/locale/tools/cldr2def.pl ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/locale/tools/cldr2def.pl Thu Jul 16 22:30:11 2009 (r195730) @@ -0,0 +1,527 @@ +#!/usr/bin/perl -wC + +use strict; +use XML::Parser; +use Text::Iconv; +use Tie::IxHash; +use Data::Dumper; +use Digest::SHA qw(sha1_hex); +require "charmaps.pm"; + +if ($#ARGV < 2) { + print "Usage: $0 [la_CC]\n"; + exit(1); +} + +my $DEFENCODING = "UTF-8"; +my $DIR = shift(@ARGV); +my $CHARMAPS = shift(@ARGV); +my $TYPE = shift(@ARGV); +my $doonly = shift(@ARGV); +my @filter = (); + +my %convertors = (); + +my %values = (); +my %hashtable = (); +my %languages = (); +my %translations = (); +get_languages(); + +my %cm = (); +get_utf8map(); + +my %keys = (); +tie(%keys, "Tie::IxHash"); +tie(%hashtable, "Tie::IxHash"); + +my %FILESNAMES = ( + "monetdef" => "LC_MONETARY", + "timedef" => "LC_TIME", + "msgdef" => "LC_MESSAGES", + "numericdef" => "LC_NUMERIC" +); + +my %callback = ( + mdorder => \&callback_mdorder, +); + +my %DESC = ( + + # numericdef + "decimal_point" => "decimal_point", + "thousands_sep" => "thousands_sep", + "grouping" => "grouping", + + # monetdef + "int_curr_symbol" => "int_curr_symbol (last character always " . + "SPACE)", + "currency_symbol" => "currency_symbol", + "mon_decimal_point" => "mon_decimal_point", + "mon_thousands_sep" => "mon_thousands_sep", + "mon_grouping" => "mon_grouping", + "positive_sign" => "positive_sign", + "negative_sign" => "negative_sign", + "int_frac_digits" => "int_frac_digits", + "frac_digits" => "frac_digits", + "p_cs_precedes" => "p_cs_precedes", + "p_sep_by_space" => "p_sep_by_space", + "n_cs_precedes" => "n_cs_precedes", + "n_sep_by_space" => "n_sep_by_space", + "p_sign_posn" => "p_sign_posn", + "n_sign_posn" => "n_sign_posn", + + # msgdef + "yesexpr" => "yesexpr", + "noexpr" => "noexpr", + "yesstr" => "yesstr", + "nostr" => "nostr", + + # timedef + "abmon" => "Short month names", + "mon" => "Long month names (as in a date)", + "abday" => "Short weekday names", + "day" => "Long weekday names", + "t_fmt" => "X_fmt", + "d_fmt" => "x_fmt", + "XXX" => "c_fmt", + "am_pm" => "AM/PM", + "d_t_fmt" => "date_fmt", + "mon2" => "Long month names (without case ending)", + "md_order" => "md_order", + "t_fmt_ampm" => "ampm_fmt", + +); + +if ($TYPE eq "numericdef") { + %keys = ( + "decimal_point" => "s", + "thousands_sep" => "s", + "grouping" => "ai", + ); + get_fields(); + print_fields(); + make_makefile(); +} + +if ($TYPE eq "monetdef") { + %keys = ( + "int_curr_symbol" => "s", + "currency_symbol" => "s", + "mon_decimal_point" => "s", + "mon_thousands_sep" => "s", + "mon_grouping" => "ai", + "positive_sign" => "s", + "negative_sign" => "s", + "int_frac_digits" => "i", + "frac_digits" => "i", + "p_cs_precedes" => "i", + "p_sep_by_space" => "i", + "n_cs_precedes" => "i", + "n_sep_by_space" => "i", + "p_sign_posn" => "i", + "n_sign_posn" => "i" + ); + get_fields(); + print_fields(); + make_makefile(); +} + +if ($TYPE eq "msgdef") { + %keys = ( + "yesexpr" => "s", + "noexpr" => "s", + "yesstr" => "s", + "nostr" => "s" + ); + get_fields(); + print_fields(); + make_makefile(); +} + +if ($TYPE eq "timedef") { + %keys = ( + "abmon" => "as", + "mon" => "as", + "abday" => "as", + "day" => "as", + "t_fmt" => "s", + "d_fmt" => "s", + "XXX" => "s", + "am_pm" => "as", + "d_fmt" => "s", + "d_t_fmt" => "s", + "mon2" => ">mon", # repeat them for now + "md_order" => " "s", + ); + get_fields(); + print_fields(); + make_makefile(); +} + +sub callback_mdorder { + my $s = shift; + return undef if (!defined $s); + $s =~ s/[^dm]//g; + return $s; +}; + +############################ + +sub get_utf8map { + open(FIN, "$DIR/posix/$DEFENCODING.cm"); + my @lines = ; + close(FIN); + chomp(@lines); + my $incharmap = 0; + foreach my $l (@lines) { + $l =~ s/\r//; + next if ($l =~ /^\#/); + next if ($l eq ""); + if ($l eq "CHARMAP") { + $incharmap = 1; + next; + } + next if (!$incharmap); + last if ($l eq "END CHARMAP"); + $l =~ /^([^\s]+)\s+(.*)/; + my $k = $1; + my $v = $2; + $v =~ s/\\x//g; + $cm{$k} = $v; + } +} + +sub get_languages { + my %data = get_xmldata($CHARMAPS); + %languages = %{$data{L}}; + %translations = %{$data{T}}; + + return if (!defined $doonly); + + my @a = split(/_/, $doonly); + if ($#a == 1) { + $filter[0] = $a[0]; + $filter[1] = "x"; + $filter[2] = $a[1]; + } elsif ($#a == 2) { + $filter[0] = $a[0]; + $filter[1] = $a[1]; + $filter[2] = $a[2]; + } + + print Dumper(@filter); + return; +} + +sub get_fields { + foreach my $l (sort keys(%languages)) { + foreach my $f (sort keys(%{$languages{$l}})) { + foreach my $c (sort keys(%{$languages{$l}{$f}{data}})) { + next if ($#filter == 2 && ($filter[0] ne $l + || $filter[1] ne $f || $filter[2] ne $c)); + + $languages{$l}{$f}{data}{$c}{$DEFENCODING} = 0; # unread + my $file; + $file = $l . "_"; + $file .= $f . "_" if ($f ne "x"); + $file .= $c; + if (!open(FIN, "$DIR/posix/$file.$DEFENCODING.src")) { + if (!defined $languages{$l}{$f}{fallback}) { + print STDERR + "Cannot open $file.$DEFENCODING.src\n"; + next; + } + $file = $languages{$l}{$f}{fallback}; + if (!open(FIN, "$DIR/posix/$file.$DEFENCODING.src")) { + print STDERR + "Cannot open fallback " . + "$file.$DEFENCODING.src\n"; + next; + } + } + print "Reading from $file.$DEFENCODING.src for ${l}_${f}_${c}\n"; + $languages{$l}{$f}{data}{$c}{$DEFENCODING} = 1; # read + my @lines = ; + chomp(@lines); + close(FIN); + my $continue = 0; + foreach my $k (keys(%keys)) { + foreach my $line (@lines) { + $line =~ s/\r//; + next if (!$continue && $line !~ /^$k\s/); + if ($continue) { + $line =~ s/^\s+//; + } else { + $line =~ s/^$k\s+//; + } + + $values{$l}{$c}{$k} = "" + if (!defined $values{$l}{$c}{$k}); + + $continue = ($line =~ /\/$/); + $line =~ s/\/$// if ($continue); + $values{$l}{$c}{$k} .= $line; + + last if (!$continue); + } + } + } + } + } +} + +sub decodecldr { + my $s = shift; + my $v = $cm{$s}; + + return pack("C", hex($v)) if (length($v) == 2); + return pack("CC", hex(substr($v, 0, 2)), hex(substr($v, 2, 2))) + if (length($v) == 4); + return pack("CCC", hex(substr($v, 0, 2)), hex(substr($v, 2, 2)), + hex(substr($v, 4, 2))) if (length($v) == 6); + return "length = " . length($v); +} + +sub translate { + my $enc = shift; + my $v = shift; + + return $translations{$enc}{$v} if (defined $translations{$enc}{$v}); + return undef; +} + +sub print_fields { + foreach my $l (sort keys(%languages)) { + foreach my $f (sort keys(%{$languages{$l}})) { + foreach my $c (sort keys(%{$languages{$l}{$f}{data}})) { + next if ($#filter == 2 && ($filter[0] ne $l + || $filter[1] ne $f || $filter[2] ne $c)); + foreach my $enc (sort keys(%{$languages{$l}{$f}{data}{$c}})) { + if ($languages{$l}{$f}{data}{$c}{$DEFENCODING} eq "0") { + print "Skipping ${l}_" . + ($f eq "x" ? "" : "${f}_") . + "${c} - not read\n"; + next; + } + my $file = $l; + $file .= "_" . $f if ($f ne "x"); + $file .= "_" . $c; + print "Writing to $file in $enc\n"; + + eval { + $convertors{$enc} = + Text::Iconv->new($DEFENCODING, $enc); + } if (!defined $convertors{$enc}); + if (!defined $convertors{$enc}) { + print "Failed! Cannot convert between " . + "$DEFENCODING and $enc.\n"; + next; + }; + + open(FOUT, ">$TYPE/$file.$enc.new"); + my $okay = 1; + my $output = ""; + print FOUT </) { + $k = substr($f, 1); + $f = $keys{$k}; + } + if ($f =~ /^\)(.*)/) { + $cm = $2; + $v = $1 . decodecldr($2) . $3; + } + my $fv = + $convertors{$enc}->convert("$v"); + $fv = translate($enc, $cm) + if (!defined $fv); + if (!defined $fv) { + print STDERR + "Could not convert $k " . + "($cm) from $DEFENCODING " . + "to $enc\n"; + $okay = 0; + next; + } + $output .= "$fv\n"; + next; + } + if ($f eq "as") { + foreach my $v (split(/;/, $v)) { + $v =~ s/^"//; + $v =~ s/"$//; + my $cm = ""; + while ($v =~ /^(.*?)(<.*?>)(.*)/) { + $cm = $2; + $v = $1 . + decodecldr($2) . $3; + } + my $fv = + $convertors{$enc}->convert("$v"); + $fv = translate($enc, $cm) + if (!defined $fv); + if (!defined $fv) { + print STDERR + "Could not " . + "convert $k ($cm)" . + " from " . + "$DEFENCODING to " . + "$enc\n"; + $okay = 0; + next; + } + $output .= "$fv\n"; + } + next; + } + + die("$k is '$f'"); + + } + + $languages{$l}{$f}{data}{$c}{$enc} = sha1_hex($output); + $hashtable{sha1_hex($output)}{"${l}_${f}_${c}.$enc"} = 1; + print FOUT "$output# EOF\n"; + close(FOUT); + + if ($okay) { + rename("$TYPE/$file.$enc.new", + "$TYPE/$file.$enc.src"); + } else { + rename("$TYPE/$file.$enc.new", + "$TYPE/$file.$enc.failed"); + } + } + } + } + } +} + +sub make_makefile { + return if ($#filter > -1); + print "Creating Makefile for $TYPE\n"; + open(FOUT, ">$TYPE/Makefile"); + print FOUT < \${.TARGET} + +EOF + + foreach my $hash (keys(%hashtable)) { + my @files = sort(keys(%{$hashtable{$hash}})); + if ($#files > 0) { + my $link = shift(@files); + $link =~ s/_x_/_/; # strip family if none there + foreach my $file (@files) { + my @a = split(/_/, $file); + my @b = split(/\./, $a[-1]); + $file =~ s/_x_/_/; + print FOUT "SAME+=\t\t$link:$file\t#hash\n"; + undef($languages{$a[0]}{$a[1]}{data}{$b[0]}{$b[1]}); + } + } + } + + foreach my $l (sort keys(%languages)) { + foreach my $f (sort keys(%{$languages{$l}})) { + foreach my $c (sort keys(%{$languages{$l}{$f}{data}})) { + next if ($#filter == 2 && ($filter[0] ne $l + || $filter[1] ne $f || $filter[2] ne $c)); + foreach my $e (sort keys(%{$languages{$l}{$f}{data}{$c}})) { + my $file = $l . "_"; + $file .= $f . "_" if ($f ne "x"); + $file .= $c; + next if (!defined $languages{$l}{$f}{data}{$c}{$e}); + print FOUT "LOCALES+=\t$file.$e\n"; + } + + if (defined $languages{$l}{$f}{link}) { + foreach my $e (sort keys(%{$languages{$l}{$f}{data}{$c}})) { + my $file = $l . "_"; + $file .= $f . "_" if ($f ne "x"); + $file .= $c; + print FOUT "SAME+=\t\t$file.$e:$languages{$l}{$f}{link}.$e\t# legacy\n"; + + } + + } + + } + } + } + + print FOUT < +EOF + + close(FOUT); +} From owner-svn-src-user@FreeBSD.ORG Fri Jul 17 07:24:35 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3724A10656A6; Fri, 17 Jul 2009 07:24:35 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1B6438FC20; Fri, 17 Jul 2009 07:24:35 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n6H7OYh6059293; Fri, 17 Jul 2009 07:24:34 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n6H7OYVr059291; Fri, 17 Jul 2009 07:24:34 GMT (envelope-from des@svn.freebsd.org) Message-Id: <200907170724.n6H7OYVr059291@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Fri, 17 Jul 2009 07:24:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r195734 - user/des/fmerge X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Jul 2009 07:24:36 -0000 Author: des Date: Fri Jul 17 07:24:34 2009 New Revision: 195734 URL: http://svn.freebsd.org/changeset/base/195734 Log: Collapse ranges, eliminate duplicates, improve handling of reverse merges. Modified: user/des/fmerge/fmerge.pl Modified: user/des/fmerge/fmerge.pl ============================================================================== --- user/des/fmerge/fmerge.pl Fri Jul 17 07:07:38 2009 (r195733) +++ user/des/fmerge/fmerge.pl Fri Jul 17 07:24:34 2009 (r195734) @@ -37,7 +37,8 @@ our $pretend; our $branch = "head"; our $target = "."; -our @revs; +our %revs = (0 => 0); +our @ranges; our $svn_path; our $svn_url; @@ -126,13 +127,75 @@ sub examine() { debug("svn_path = '$svn_path'"); } +sub addrevs($$) { + my ($m, $n) = @_; + if ($m > $n) { + for (my $i = $m; $i > $n; --$i) { + $revs{$i} = -1; + } + } else { + for (my $i = $m + 1; $i <= $n; ++$i) { + $revs{$i} = +1; + } + } +} + +sub revs2ranges() { + my ($m, $n); + # process in reverse, 0 acts as a sentinel + foreach my $i (sort({ $b <=> $a } keys(%revs)), 0) { + if (!$m) { + $m = $n = $i; + next; + } elsif ($i == $m - 1 && $revs{$m} == +1 && $revs{$i} == +1) { + $m = $i; + next; + } elsif ($i == $m + 1 && $revs{$m} == -1 && $revs{$i} == -1) { + $m = $i; + next; + } else { + if ($revs{$m} == +1) { + push(@ranges, [ $m - 1, $n ]); + } elsif ($revs{$m} == -1) { + push(@ranges, [ $n, $m - 1 ]); + } + $m = $n = $i; + } + } +} + +sub printranges($) { + my ($fh) = @_; + my @print; + foreach my $range (@ranges) { + my ($m, $n) = @{$range}; + if ($n == $m + 1) { + push(@print, $n); + } elsif ($n == $m - 1) { + push(@print, "-$m"); + } else { + push(@print, "$m:$n"); + } + } + print($fh "merging ", join(', ', @print), "\n") + if @print; +} + sub fmerge() { - if (!@revs) { + if (!@ranges) { svn_merge("$svn_root/$branch/$svn_path", $target); } - foreach my $rev (@revs) { - my ($m, $n) = @{$rev}; - svn_merge("-r$m:$n", "$svn_root/$branch/$svn_path", $target); + foreach my $range (@ranges) { + my ($m, $n) = @{$range}; + my $spec; + if ($n == $m + 1) { + $spec = "-c$n"; + } elsif ($n == $m - 1) { + $spec = "-c-$n"; + } else { + $spec = "-r$m:$n"; + } + svn_merge($spec, "$svn_root/$branch/$svn_path", $target); } } @@ -166,11 +229,15 @@ MAIN:{ while (@ARGV && $ARGV[0] =~ m/^[cr]?\d+([-:][cr]?\d+)?(,[cr]?\d+([-:][cr]?\d+)?)*$/) { foreach my $rev (split(',', $ARGV[0])) { if ($rev =~ m/^[cr]?(\d+)$/) { - push(@revs, [ $1 - 1, $1 ]); + addrevs($1 - 1, $1); } elsif ($rev =~ m/^[cr]?-(\d+)$/) { - push(@revs, [ $1, $1 - 1 ]); + addrevs($1, $1 - 1); } elsif ($rev =~ m/^[cr]?(\d+)[-:][cr]?(\d+)$/) { - push(@revs, [ $1, $2 ]); + if ($1 < $2) { + addrevs($1 - 1, $2); + } else { + addrevs($1, $2 - 1); + } } else { usage(); } @@ -203,6 +270,9 @@ MAIN:{ } examine(); + revs2ranges(); + printranges(\*STDERR) + if $debug; fmerge(); } From owner-svn-src-user@FreeBSD.ORG Fri Jul 17 07:31:29 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AA1081065700; Fri, 17 Jul 2009 07:31:29 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7D74D8FC12; Fri, 17 Jul 2009 07:31:29 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n6H7VTqY059911; Fri, 17 Jul 2009 07:31:29 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n6H7VTAj059909; Fri, 17 Jul 2009 07:31:29 GMT (envelope-from des@svn.freebsd.org) Message-Id: <200907170731.n6H7VTAj059909@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Fri, 17 Jul 2009 07:31:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r195735 - user/des/fmerge X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Jul 2009 07:31:30 -0000 Author: des Date: Fri Jul 17 07:31:29 2009 New Revision: 195735 URL: http://svn.freebsd.org/changeset/base/195735 Log: Improve debugging messages. Modified: user/des/fmerge/fmerge.pl Modified: user/des/fmerge/fmerge.pl ============================================================================== --- user/des/fmerge/fmerge.pl Fri Jul 17 07:24:34 2009 (r195734) +++ user/des/fmerge/fmerge.pl Fri Jul 17 07:31:29 2009 (r195735) @@ -46,7 +46,7 @@ our $svn_root; our $svn_branch; sub info(@) { - print(STDOUT join(' ', @_), "\n"); + print(STDERR join(' ', @_), "\n"); } sub debug(@) { @@ -54,10 +54,12 @@ sub debug(@) { if $debug; } -sub svn_check($;$) { - my ($cond, $msg) = @_; - die(($msg || 'something is rotten in the state of subversion') . "\n") - unless $cond; +sub svn_check($@) { + my ($cond, @msg) = @_; + if (!$cond) { + info(@msg); + exit(1); + } } sub svn_do(@) { @@ -76,7 +78,6 @@ sub svn_merge(@) { sub svn_catch(@) { my (@argv) = @_; - debug('svn', @argv); open(my $fh, '-|', 'svn', @argv) or die("fmerge: could not run svn\n"); @@ -90,8 +91,7 @@ sub examine() { my ($key, $value) = split(/:\s+/, $_, 2); next unless $key && $value; if ($key eq 'Path') { - debug("'$value' eq '$target'?"); - svn_check($value eq $target); + svn_check($value eq $target, "path mismatch: $value != $target"); } elsif ($key eq 'URL') { $svn_url = $value; } elsif ($key eq 'Repository Root') { @@ -100,14 +100,15 @@ sub examine() { } close($fh); - svn_check($svn_url =~ m@^\Q$svn_root\E(/.*)$@); + svn_check($svn_url =~ m@^\Q$svn_root\E(/.*)$@, "invalid svn URL: $svn_url"); $svn_path = $1; + debug("guessing merge source / target directory"); $fh = svn_catch('propget', 'svn:mergeinfo', $target); while (<$fh>) { chomp(); - debug("'$_' =~ m\@\Q/$branch\E((?:/[\\w.-]+)*):\@"); - next unless m@\Q/$branch\E((?:/[\w.-]+)*):@; + debug("'$_' =~ m\@^\Q/$branch\E((?:/[\\w.-]+)*):\@"); + next unless m@^\Q/$branch\E((?:/[\w.-]+)*):@; my $subdir = $1; debug("'$svn_path' =~ m\@^((?:/[\\w.-]+)+)\Q$subdir\E\$\@"); next unless $svn_path =~ m@^((?:/[\w.-]+)+)\Q$subdir\E$@; @@ -116,13 +117,15 @@ sub examine() { last; } close($fh); + if (!$svn_branch) { # try to guess a stable / releng / release branch + debug("guessing source branch"); debug("'$svn_path' =~ s\@^/([\\w+.-]/\\d+(?:\\.\\d+)*)/?\@\@"); $svn_path =~ s@^/(\w+/\d+(?:\.\d+)*)/?@@; $svn_branch = $1; } - svn_check($svn_branch); + svn_check($svn_branch, "unable to figure out source branch"); debug("svn_branch = '$svn_branch'"); debug("svn_path = '$svn_path'"); } From owner-svn-src-user@FreeBSD.ORG Fri Jul 17 07:32:23 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0FB51106566C; Fri, 17 Jul 2009 07:32:23 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D91CA8FC1C; Fri, 17 Jul 2009 07:32:22 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n6H7WM0E060015; Fri, 17 Jul 2009 07:32:22 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n6H7WMSE060014; Fri, 17 Jul 2009 07:32:22 GMT (envelope-from des@svn.freebsd.org) Message-Id: <200907170732.n6H7WMSE060014@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Fri, 17 Jul 2009 07:32:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r195736 - user/des/fmerge X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Jul 2009 07:32:23 -0000 Author: des Date: Fri Jul 17 07:32:22 2009 New Revision: 195736 URL: http://svn.freebsd.org/changeset/base/195736 Log: Expand $FreeBSD$ Modified: user/des/fmerge/fmerge.pl (props changed) From owner-svn-src-user@FreeBSD.ORG Fri Jul 17 07:47:59 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1B480106566C; Fri, 17 Jul 2009 07:47:59 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0AA228FC0C; Fri, 17 Jul 2009 07:47:59 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n6H7lw1A061419; Fri, 17 Jul 2009 07:47:58 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n6H7lwEL061417; Fri, 17 Jul 2009 07:47:58 GMT (envelope-from des@svn.freebsd.org) Message-Id: <200907170747.n6H7lwEL061417@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Fri, 17 Jul 2009 07:47:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r195737 - user/des/fmerge X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Jul 2009 07:47:59 -0000 Author: des Date: Fri Jul 17 07:47:58 2009 New Revision: 195737 URL: http://svn.freebsd.org/changeset/base/195737 Log: Rework handling of svn subprocesses. Modified: user/des/fmerge/fmerge.pl Modified: user/des/fmerge/fmerge.pl ============================================================================== --- user/des/fmerge/fmerge.pl Fri Jul 17 07:32:22 2009 (r195736) +++ user/des/fmerge/fmerge.pl Fri Jul 17 07:47:58 2009 (r195737) @@ -67,6 +67,22 @@ sub svn_do(@) { info('svn', @argv); system('svn', @argv) unless $pretend; + my $pid = fork(); + if ($pid == -1) { + die("fork(): $!\n"); + } elsif ($pid == 0) { + exec('svn', @argv); + die("exec(): $!\n"); + } + waitpid($pid, 0); + info($?); + if ($? & 128) { + info("svn died with signal", $? & 128); + kill($? & 128, $$); + } elsif ($?) { + info("svn returned error status", $? >> 8); + exit(1); + } } sub svn_merge(@) {